Duncan pointed out that we can fast fail here, because the sret parameter of
a function must be the first parameter.

llvm-svn: 47254
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index fe3f2fe..e7a7041 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -107,7 +107,8 @@
 /// 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);
 }