summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2018-04-12 02:06:01 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2018-04-12 02:06:01 +0000
commit48ee59b6f05d46a0d4996e920ca702374a979873 (patch)
tree636c87855d5bff244ce54136eb0d809c284aea32 /llvm/lib/Transforms
parenta8c689e70cc7413d5c985f9bc330804d0a0b1266 (diff)
downloadbcm5719-llvm-48ee59b6f05d46a0d4996e920ca702374a979873.tar.gz
bcm5719-llvm-48ee59b6f05d46a0d4996e920ca702374a979873.zip
[DeadArgElim] Remove allocsize attributes on callsites
We're already removing allocsize attributes from Functions that we remove args from, since removing arguments from a function may make the allocsize attribute incorrect. It appears we forgot to also remove them from callsites. Without this, I get verifier errors on `@Test2`. It probably wouldn't be too hard to make DAE properly update allocsize attributes instead of dropping them, but I can't think of a scenario where that'd be useful in practice. llvm-svn: 329868
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 0c54b7fc930..4ef8e4b509a 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -916,8 +916,14 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
// Reconstruct the AttributesList based on the vector we constructed.
assert(ArgAttrVec.size() == Args.size());
+
+ // Again, be sure to remove any allocsize attributes, since their indices
+ // may now be incorrect.
+ AttributeSet FnAttrs = CallPAL.getFnAttributes().removeAttribute(
+ F->getContext(), Attribute::AllocSize);
+
AttributeList NewCallPAL = AttributeList::get(
- F->getContext(), CallPAL.getFnAttributes(), RetAttrs, ArgAttrVec);
+ F->getContext(), FnAttrs, RetAttrs, ArgAttrVec);
SmallVector<OperandBundleDef, 1> OpBundles;
CS.getOperandBundlesAsDefs(OpBundles);
OpenPOWER on IntegriCloud