summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-04-19 23:45:45 +0000
committerReid Kleckner <rnk@google.com>2017-04-19 23:45:45 +0000
commitf1de9e83c26eec07f9bea393b604cb6d6d1dffb0 (patch)
tree4e9246268c3e414e9ce1f919e6398845ee689c18 /llvm/lib/Transforms
parent7fe92fc521400cddc7aac2236dc62d22c0f9b1eb (diff)
downloadbcm5719-llvm-f1de9e83c26eec07f9bea393b604cb6d6d1dffb0.tar.gz
bcm5719-llvm-f1de9e83c26eec07f9bea393b604cb6d6d1dffb0.zip
[DAE] Simplify attribute list creation, NFC
Removes a use of getSlotAttributes, which I intend to change. llvm-svn: 300795
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 375b74c494d..8e26849ea9e 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -167,15 +167,12 @@ bool DeadArgumentEliminationPass::DeleteDeadVarargs(Function &Fn) {
// Drop any attributes that were on the vararg arguments.
AttributeList PAL = CS.getAttributes();
- if (!PAL.isEmpty() && PAL.getSlotIndex(PAL.getNumSlots() - 1) > NumArgs) {
- SmallVector<AttributeList, 8> AttributesVec;
- for (unsigned i = 0; PAL.getSlotIndex(i) <= NumArgs; ++i)
- AttributesVec.push_back(PAL.getSlotAttributes(i));
- if (PAL.hasAttributes(AttributeList::FunctionIndex))
- AttributesVec.push_back(AttributeList::get(Fn.getContext(),
- AttributeList::FunctionIndex,
- PAL.getFnAttributes()));
- PAL = AttributeList::get(Fn.getContext(), AttributesVec);
+ if (!PAL.isEmpty()) {
+ SmallVector<AttributeSet, 8> ArgAttrs;
+ for (unsigned ArgNo = 0; ArgNo < NumArgs; ++ArgNo)
+ ArgAttrs.push_back(PAL.getParamAttributes(ArgNo));
+ PAL = AttributeList::get(Fn.getContext(), PAL.getFnAttributes(),
+ PAL.getRetAttributes(), ArgAttrs);
}
SmallVector<OperandBundleDef, 1> OpBundles;
OpenPOWER on IntegriCloud