ArgumentPromotion: Drop sret attribute on functions that are only called directly.
[oota-llvm.git] / lib / IR / Function.cpp
index cf8e3ed571e3402ea816b767c1b1ff83ca25c74c..2b439bb46bf7b0cd5f116a79638cbe6d8ff515b7 100644 (file)
@@ -154,10 +154,8 @@ bool Argument::hasNoCaptureAttr() const {
 /// it in its containing function.
 bool Argument::hasStructRetAttr() const {
   if (!getType()->isPointerTy()) return false;
-  if (this != getParent()->arg_begin())
-    return false; // StructRet param must be first param
   return getParent()->getAttributes().
-    hasAttribute(1, Attribute::StructRet);
+    hasAttribute(getArgNo()+1, Attribute::StructRet);
 }
 
 /// hasReturnedAttr - Return true if this argument has the returned attribute on