diff options
author | Reid Kleckner <rnk@google.com> | 2017-04-19 23:17:47 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-04-19 23:17:47 +0000 |
commit | aa0cec7d6dbe602af9e0f9f0bb89eb750856baf2 (patch) | |
tree | 0e4eec163db663231905026cdcd438df48186298 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | 2cc97d92cebd112861c05eda3755af8661148015 (diff) | |
download | bcm5719-llvm-aa0cec7d6dbe602af9e0f9f0bb89eb750856baf2.tar.gz bcm5719-llvm-aa0cec7d6dbe602af9e0f9f0bb89eb750856baf2.zip |
Simplify test for sret attribute in instcombine
This change is correct because the verifier requires that at most one
argument be marked 'sret'.
NFC, removes a use of AttributeList slot APIs.
llvm-svn: 300784
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 7ed999fa70b..e7aa1a45737 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -4068,21 +4068,15 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { } if (FT->getNumParams() < NumActualArgs && FT->isVarArg() && - !CallerPAL.isEmpty()) + !CallerPAL.isEmpty()) { // In this case we have more arguments than the new function type, but we // won't be dropping them. Check that these extra arguments have attributes // that are compatible with being a vararg call argument. - for (unsigned i = CallerPAL.getNumSlots(); i; --i) { - unsigned Index = CallerPAL.getSlotIndex(i - 1); - if (Index <= FT->getNumParams()) - break; - - // Check if it has an attribute that's incompatible with varargs. - AttributeList PAttrs = CallerPAL.getSlotAttributes(i - 1); - if (PAttrs.hasAttribute(Index, Attribute::StructRet)) - return false; - } - + unsigned SRetIdx; + if (CallerPAL.hasAttrSomewhere(Attribute::StructRet, &SRetIdx) && + SRetIdx > FT->getNumParams()) + return false; + } // Okay, we decided that this is a safe thing to do: go ahead and start // inserting cast instructions as necessary. |