If a function uses multive values in ret instruction then it
authorDevang Patel <dpatel@apple.com>
Mon, 3 Mar 2008 18:58:16 +0000 (18:58 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 3 Mar 2008 18:58:16 +0000 (18:58 +0000)
is returning a struct value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47848 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Function.cpp
lib/VMCore/Verifier.cpp

index d9133588d8528359cc36c688643a64463d1d78ab..92737f66d92b09117eebd7ab22db4fbf5a6e6cef 100644 (file)
@@ -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<StructType>(getReturnType());
 }
 
 //===----------------------------------------------------------------------===//
index 575bb82df756cd411a67061d0440292fc814bc0b..3d6832475f6d78f9156e881fee26113d994f5113 100644 (file)
@@ -455,9 +455,6 @@ void Verifier::visitFunction(Function &F) {
           isa<StructType>(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 ||