diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index fe3f2fe770c..e7a7041d778 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -107,7 +107,8 @@ bool Argument::hasNoAliasAttr() const { /// it in its containing function. bool Argument::hasStructRetAttr() const { if (!isa(getType())) return false; - return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::StructRet); + if (getArgNo()) return false; // StructRet param must be first param + return getParent()->paramHasAttr(1, ParamAttr::StructRet); }