diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index d9133588d85..92737f66d92 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -170,7 +170,8 @@ bool Function::onlyReadsMemory() const { /// @brief Determine if the function returns a structure. bool Function::isStructReturn() const { - return paramHasAttr(1, ParamAttr::StructRet); + return paramHasAttr(1, ParamAttr::StructRet) + || isa(getReturnType()); } //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 575bb82df75..3d6832475f6 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -455,9 +455,6 @@ void Verifier::visitFunction(Function &F) { isa(F.getReturnType()), "Functions cannot return aggregate values!", &F); - Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy, - "Invalid struct-return function!", &F); - const ParamAttrsList *Attrs = F.getParamAttrs(); Assert1(!Attrs ||