Duncan pointed out that we can fast fail here, because the sret parameter of
authorOwen Anderson <resistor@mac.com>
Mon, 18 Feb 2008 04:06:26 +0000 (04:06 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 18 Feb 2008 04:06:26 +0000 (04:06 +0000)
a function must be the first parameter.

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

lib/VMCore/Function.cpp

index fe3f2fe770cceddf070b89afdf541b0be3129067..e7a7041d778ffff6ceb3cbdc3d78b060b39e9e4f 100644 (file)
@@ -107,7 +107,8 @@ bool Argument::hasNoAliasAttr() const {
 /// it in its containing function.
 bool Argument::hasStructRetAttr() const {
   if (!isa<PointerType>(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);
 }