[llvm] r300795 - [DAE] Simplify attribute list creation, NFC
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 19 16:45:46 PDT 2017
Author: rnk
Date: Wed Apr 19 18:45:45 2017
New Revision: 300795
URL: http://llvm.org/viewvc/llvm-project?rev=300795&view=rev
Log:
[DAE] Simplify attribute list creation, NFC
Removes a use of getSlotAttributes, which I intend to change.
Modified:
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=300795&r1=300794&r2=300795&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Apr 19 18:45:45 2017
@@ -167,15 +167,12 @@ bool DeadArgumentEliminationPass::Delete
// 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;
More information about the llvm-commits
mailing list