aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-04-10 23:31:05 +0000
committerReid Kleckner <rnk@google.com>2017-04-10 23:31:05 +0000
commiteb9dd5b87f43cbd9641fba0555b775589e49af33 (patch)
tree3aed507a5bb8b601a92c13399bf2a54d54fed432 /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parent75696ffa2533abb4e4db406d4e2de42e86197413 (diff)
downloadllvm-eb9dd5b87f43cbd9641fba0555b775589e49af33.zip
llvm-eb9dd5b87f43cbd9641fba0555b775589e49af33.tar.gz
llvm-eb9dd5b87f43cbd9641fba0555b775589e49af33.tar.bz2
Reland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"
This re-lands r299875. I introduced a bug in Clang code responsible for replacing K&R, no prototype declarations with a real function definition with a prototype. The bug was here: // Collect any return attributes from the call. - if (oldAttrs.hasAttributes(llvm::AttributeList::ReturnIndex)) - newAttrs.push_back(llvm::AttributeList::get(newFn->getContext(), - oldAttrs.getRetAttributes())); + newAttrs.push_back(oldAttrs.getRetAttributes()); Previously getRetAttributes() carried AttributeList::ReturnIndex in its AttributeList. Now that we return the AttributeSetNode* directly, it no longer carries that index, and we call this overload with a single node: AttributeList::get(LLVMContext&, ArrayRef<AttributeSetNode*>) That aborted with an assertion on x86_32 targets. I added an explicit triple to the test and added CHECKs to help find issues like this in the future sooner. llvm-svn: 299899
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index dc73902..5d41ca9 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -439,8 +439,7 @@ void MergeFunctions::replaceDirectCallers(Function *Old, Function *New) {
Context, AttributeList::ReturnIndex, NewFuncAttrs.getRetAttributes());
for (unsigned argIdx = 0; argIdx < CS.arg_size(); argIdx++) {
- AttributeList Attrs = NewFuncAttrs.getParamAttributes(argIdx);
- if (Attrs.getNumSlots())
+ if (AttributeSetNode *Attrs = NewFuncAttrs.getParamAttributes(argIdx))
CallSiteAttrs = CallSiteAttrs.addAttributes(Context, argIdx, Attrs);
}