From d15d5e3bbe94702101f747326f3035e7409d2a7f Mon Sep 17 00:00:00 2001 From: Devang Patel <dpatel@apple.com> Date: Mon, 3 Mar 2008 18:58:16 +0000 Subject: [PATCH] If a function uses multive values in ret instruction then it 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 | 3 ++- lib/VMCore/Verifier.cpp | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) 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<StructType>(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<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 ||