Skip to content

Commit

Permalink
[DAE] Simplify attribute list creation, NFC
Browse files Browse the repository at this point in the history
Removes a use of getSlotAttributes, which I intend to change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300795 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rnk committed Apr 19, 2017
1 parent d92618f commit ae23971
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/Transforms/IPO/DeadArgumentElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ae23971

Please sign in to comment.