Skip to content

Commit fd42264

Browse files
author
git apple-llvm automerger
committed
Merge commit 'a9831cce1e7a' from llvm.org/main into next
2 parents 6ec12f5 + a9831cc commit fd42264

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,20 @@ struct AssumeBuilderState {
203203
}
204204

205205
void addCall(const CallBase *Call) {
206-
auto addAttrList = [&](AttributeList AttrList) {
207-
for (unsigned Idx = AttributeList::FirstArgIndex;
208-
Idx < AttrList.getNumAttrSets(); Idx++)
209-
for (Attribute Attr : AttrList.getAttributes(Idx)) {
206+
auto addAttrList = [&](AttributeList AttrList, unsigned NumArgs) {
207+
for (unsigned Idx = 0; Idx < NumArgs; Idx++)
208+
for (Attribute Attr : AttrList.getParamAttrs(Idx)) {
210209
bool IsPoisonAttr = Attr.hasAttribute(Attribute::NonNull) ||
211210
Attr.hasAttribute(Attribute::Alignment);
212-
if (!IsPoisonAttr || Call->isPassingUndefUB(Idx - 1))
213-
addAttribute(Attr, Call->getArgOperand(Idx - 1));
211+
if (!IsPoisonAttr || Call->isPassingUndefUB(Idx))
212+
addAttribute(Attr, Call->getArgOperand(Idx));
214213
}
215214
for (Attribute Attr : AttrList.getFnAttrs())
216215
addAttribute(Attr, nullptr);
217216
};
218-
addAttrList(Call->getAttributes());
217+
addAttrList(Call->getAttributes(), Call->arg_size());
219218
if (Function *Fn = Call->getCalledFunction())
220-
addAttrList(Fn->getAttributes());
219+
addAttrList(Fn->getAttributes(), Fn->arg_size());
221220
}
222221

223222
AssumeInst *build() {

llvm/unittests/IR/AttributesTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TEST(Attributes, Ordering) {
5454
AttributeList::get(C, 1, Attribute::SExt)};
5555

5656
AttributeList SetA = AttributeList::get(C, ASs);
57-
AttributeList SetB = SetA.removeAttributes(C, 1, ASs[1].getAttributes(1));
57+
AttributeList SetB = SetA.removeAttributes(C, 1, ASs[1].getParamAttrs(0));
5858
EXPECT_NE(SetA, SetB);
5959
}
6060

0 commit comments

Comments
 (0)