Skip to content

Commit 84bf0da

Browse files
authored
[Attributor][FIX] Ensure to always translate call site arguments (#107323)
When we propagate call site arguments we always need to translate them, this is important as we ended up picking the function argument for a recurisve call not the call site argument. `@recBad` and `@recGood` in `returned.ll` show the problem as they used to transform them the same way. The restructuring cleans the code up and helps derive more "returned" arguments and better information in the presence of recursive calls. The "dropped" attributes are simply dropped because we do not query them anymore, not because we cannot derive them.
1 parent 08533a3 commit 84bf0da

File tree

8 files changed

+197
-122
lines changed

8 files changed

+197
-122
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 40 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11516,9 +11516,21 @@ struct AAPotentialValuesReturned : public AAPotentialValuesFloating {
1151611516
return false;
1151711517
if (!AddValues)
1151811518
continue;
11519-
for (const AA::ValueAndContext &VAC : Values)
11519+
11520+
bool AllInterAreIntra = false;
11521+
if (S == AA::Interprocedural)
11522+
AllInterAreIntra =
11523+
llvm::all_of(Values, [&](const AA::ValueAndContext &VAC) {
11524+
return AA::isValidInScope(*VAC.getValue(), AnchorScope);
11525+
});
11526+
11527+
for (const AA::ValueAndContext &VAC : Values) {
1152011528
addValue(A, getState(), *VAC.getValue(),
11521-
VAC.getCtxI() ? VAC.getCtxI() : CtxI, S, AnchorScope);
11529+
VAC.getCtxI() ? VAC.getCtxI() : CtxI,
11530+
AllInterAreIntra ? AA::AnyScope : S, AnchorScope);
11531+
}
11532+
if (AllInterAreIntra)
11533+
break;
1152211534
}
1152311535
return true;
1152411536
};
@@ -11547,16 +11559,6 @@ struct AAPotentialValuesReturned : public AAPotentialValuesFloating {
1154711559
: ChangeStatus::CHANGED;
1154811560
}
1154911561

11550-
void addValue(Attributor &A, StateType &State, Value &V,
11551-
const Instruction *CtxI, AA::ValueScope S,
11552-
Function *AnchorScope) const override {
11553-
Function *F = getAssociatedFunction();
11554-
if (auto *CB = dyn_cast<CallBase>(&V))
11555-
if (CB->getCalledOperand() == F)
11556-
return;
11557-
Base::addValue(A, State, V, CtxI, S, AnchorScope);
11558-
}
11559-
1156011562
ChangeStatus manifest(Attributor &A) override {
1156111563
if (ReturnedArg)
1156211564
return ChangeStatus::UNCHANGED;
@@ -11651,64 +11653,39 @@ struct AAPotentialValuesCallSiteReturned : AAPotentialValuesImpl {
1165111653
UsedAssumedInformation))
1165211654
return indicatePessimisticFixpoint();
1165311655

11654-
SmallVector<AA::ValueAndContext> Values;
11655-
if (!A.getAssumedSimplifiedValues(IRPosition::returned(*Callee), this,
11656-
Values, AA::Intraprocedural,
11657-
UsedAssumedInformation))
11658-
return indicatePessimisticFixpoint();
11659-
1166011656
Function *Caller = CB->getCaller();
1166111657

11662-
bool AnyNonLocal = false;
11663-
for (auto &It : Values) {
11664-
Value *V = It.getValue();
11665-
std::optional<Value *> CallerV = A.translateArgumentToCallSiteContent(
11666-
V, *CB, *this, UsedAssumedInformation);
11667-
if (!CallerV.has_value()) {
11668-
// Nothing to do as long as no value was determined.
11669-
continue;
11670-
}
11671-
V = *CallerV ? *CallerV : V;
11672-
if (AA::isDynamicallyUnique(A, *this, *V) &&
11673-
AA::isValidInScope(*V, Caller)) {
11674-
if (*CallerV) {
11675-
SmallVector<AA::ValueAndContext> ArgValues;
11676-
IRPosition IRP = IRPosition::value(*V);
11677-
if (auto *Arg = dyn_cast<Argument>(V))
11678-
if (Arg->getParent() == CB->getCalledOperand())
11679-
IRP = IRPosition::callsite_argument(*CB, Arg->getArgNo());
11680-
if (recurseForValue(A, IRP, AA::AnyScope))
11681-
continue;
11682-
}
11683-
addValue(A, getState(), *V, CB, AA::AnyScope, getAnchorScope());
11684-
} else {
11685-
AnyNonLocal = true;
11686-
break;
11687-
}
11688-
}
11689-
if (AnyNonLocal) {
11690-
Values.clear();
11658+
auto AddScope = [&](AA::ValueScope S) {
11659+
SmallVector<AA::ValueAndContext> Values;
1169111660
if (!A.getAssumedSimplifiedValues(IRPosition::returned(*Callee), this,
11692-
Values, AA::Interprocedural,
11693-
UsedAssumedInformation))
11694-
return indicatePessimisticFixpoint();
11695-
AnyNonLocal = false;
11696-
getState() = PotentialLLVMValuesState::getBestState();
11661+
Values, S, UsedAssumedInformation))
11662+
return false;
11663+
1169711664
for (auto &It : Values) {
1169811665
Value *V = It.getValue();
11699-
if (!AA::isDynamicallyUnique(A, *this, *V))
11700-
return indicatePessimisticFixpoint();
11701-
if (AA::isValidInScope(*V, Caller)) {
11702-
addValue(A, getState(), *V, CB, AA::AnyScope, getAnchorScope());
11703-
} else {
11704-
AnyNonLocal = true;
11705-
addValue(A, getState(), *V, CB, AA::Interprocedural,
11706-
getAnchorScope());
11666+
std::optional<Value *> CallerV = A.translateArgumentToCallSiteContent(
11667+
V, *CB, *this, UsedAssumedInformation);
11668+
if (!CallerV.has_value()) {
11669+
// Nothing to do as long as no value was determined.
11670+
continue;
11671+
}
11672+
V = *CallerV ? *CallerV : V;
11673+
if (*CallerV && AA::isDynamicallyUnique(A, *this, *V)) {
11674+
if (recurseForValue(A, IRPosition::value(*V), S))
11675+
continue;
11676+
}
11677+
if (S == AA::Intraprocedural && !AA::isValidInScope(*V, Caller)) {
11678+
giveUpOnIntraprocedural(A);
11679+
return true;
1170711680
}
11681+
addValue(A, getState(), *V, CB, S, getAnchorScope());
1170811682
}
11709-
if (AnyNonLocal)
11710-
giveUpOnIntraprocedural(A);
11711-
}
11683+
return true;
11684+
};
11685+
if (!AddScope(AA::Intraprocedural))
11686+
return indicatePessimisticFixpoint();
11687+
if (!AddScope(AA::Interprocedural))
11688+
return indicatePessimisticFixpoint();
1171211689
return (AssumedBefore == getAssumed()) ? ChangeStatus::UNCHANGED
1171311690
: ChangeStatus::CHANGED;
1171411691
}

llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ define void @fn2(ptr %P, i1 %C) {
1616
; TUNIT: if.end:
1717
; TUNIT-NEXT: [[E_2:%.*]] = phi ptr [ [[P]], [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ]
1818
; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[E_2]], align 4
19-
; TUNIT-NEXT: [[CALL:%.*]] = call i32 @fn1(i32 [[TMP0]]) #[[ATTR3:[0-9]+]]
20-
; TUNIT-NEXT: store i32 [[CALL]], ptr [[P]], align 4
19+
; TUNIT-NEXT: store i32 [[TMP0]], ptr [[P]], align 4
2120
; TUNIT-NEXT: br label [[FOR_COND1]]
2221
; TUNIT: exit:
2322
; TUNIT-NEXT: ret void
@@ -55,11 +54,11 @@ exit:
5554
}
5655

5756
define internal i32 @fn1(i32 %p1) {
58-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
59-
; CHECK-LABEL: define {{[^@]+}}@fn1
60-
; CHECK-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] {
61-
; CHECK-NEXT: entry:
62-
; CHECK-NEXT: ret i32 [[P1]]
57+
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
58+
; CGSCC-LABEL: define {{[^@]+}}@fn1
59+
; CGSCC-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] {
60+
; CGSCC-NEXT: entry:
61+
; CGSCC-NEXT: ret i32 [[P1]]
6362
;
6463
entry:
6564
%tobool = icmp ne i32 %p1, 0
@@ -71,16 +70,15 @@ define void @fn_no_null_opt(ptr %P, i1 %C) null_pointer_is_valid {
7170
;
7271
; TUNIT: Function Attrs: nofree norecurse nosync nounwind null_pointer_is_valid
7372
; TUNIT-LABEL: define {{[^@]+}}@fn_no_null_opt
74-
; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]], i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] {
73+
; TUNIT-SAME: (ptr nocapture nofree writeonly [[P:%.*]], i1 [[C:%.*]]) #[[ATTR1:[0-9]+]] {
7574
; TUNIT-NEXT: entry:
7675
; TUNIT-NEXT: br label [[IF_END:%.*]]
7776
; TUNIT: for.cond1:
7877
; TUNIT-NEXT: br i1 [[C]], label [[IF_END]], label [[EXIT:%.*]]
7978
; TUNIT: if.end:
8079
; TUNIT-NEXT: [[E_2:%.*]] = phi ptr [ undef, [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ]
8180
; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr null, align 4294967296
82-
; TUNIT-NEXT: [[CALL:%.*]] = call i32 @fn0(i32 [[TMP0]]) #[[ATTR3]]
83-
; TUNIT-NEXT: store i32 [[CALL]], ptr [[P]], align 4
81+
; TUNIT-NEXT: store i32 [[TMP0]], ptr [[P]], align 4
8482
; TUNIT-NEXT: br label [[FOR_COND1]]
8583
; TUNIT: exit:
8684
; TUNIT-NEXT: ret void
@@ -118,11 +116,11 @@ exit:
118116
}
119117

120118
define internal i32 @fn0(i32 %p1) {
121-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
122-
; CHECK-LABEL: define {{[^@]+}}@fn0
123-
; CHECK-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1]] {
124-
; CHECK-NEXT: entry:
125-
; CHECK-NEXT: ret i32 [[P1]]
119+
; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
120+
; CGSCC-LABEL: define {{[^@]+}}@fn0
121+
; CGSCC-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1]] {
122+
; CGSCC-NEXT: entry:
123+
; CGSCC-NEXT: ret i32 [[P1]]
126124
;
127125
entry:
128126
%tobool = icmp ne i32 %p1, 0
@@ -131,12 +129,12 @@ entry:
131129
}
132130
;.
133131
; TUNIT: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind memory(argmem: readwrite) }
134-
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
135-
; TUNIT: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind null_pointer_is_valid }
136-
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind memory(none) }
132+
; TUNIT: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind null_pointer_is_valid }
137133
;.
138134
; CGSCC: attributes #[[ATTR0]] = { nofree nosync nounwind memory(argmem: readwrite) }
139135
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
140136
; CGSCC: attributes #[[ATTR2]] = { nofree nosync nounwind null_pointer_is_valid }
141137
; CGSCC: attributes #[[ATTR3]] = { nofree nosync }
142138
;.
139+
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
140+
; CHECK: {{.*}}

llvm/test/Transforms/Attributor/align.ll

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,14 @@ define void @test9_traversal(i1 %cnd, ptr align 4 %B, ptr align 8 %C) {
416416
; FIXME: This will work with an upcoming patch (D66618 or similar)
417417
; store i32 -1, ptr %g1, align 32
418418
define ptr @test10a(ptr align 32 %p) {
419-
; TUNIT: Function Attrs: nofree nosync nounwind
419+
; TUNIT: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
420420
; TUNIT-LABEL: define {{[^@]+}}@test10a
421421
; TUNIT-SAME: (ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR3:[0-9]+]] {
422422
; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 32
423423
; TUNIT-NEXT: [[C:%.*]] = icmp eq i32 [[L]], 0
424424
; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
425425
; TUNIT: t:
426-
; TUNIT-NEXT: [[R:%.*]] = call align 32 ptr @test10a(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR3]]
426+
; TUNIT-NEXT: [[R:%.*]] = call align 32 ptr @test10a(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR13:[0-9]+]]
427427
; TUNIT-NEXT: store i32 1, ptr [[R]], align 32
428428
; TUNIT-NEXT: [[G0:%.*]] = getelementptr i32, ptr [[P]], i32 8
429429
; TUNIT-NEXT: br label [[E:%.*]]
@@ -435,14 +435,14 @@ define ptr @test10a(ptr align 32 %p) {
435435
; TUNIT-NEXT: [[PHI:%.*]] = phi ptr [ [[G0]], [[T]] ], [ [[G1]], [[F]] ]
436436
; TUNIT-NEXT: ret ptr [[PHI]]
437437
;
438-
; CGSCC: Function Attrs: nofree nosync nounwind
438+
; CGSCC: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
439439
; CGSCC-LABEL: define {{[^@]+}}@test10a
440440
; CGSCC-SAME: (ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR4:[0-9]+]] {
441441
; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 32
442442
; CGSCC-NEXT: [[C:%.*]] = icmp eq i32 [[L]], 0
443443
; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
444444
; CGSCC: t:
445-
; CGSCC-NEXT: [[R:%.*]] = call align 32 ptr @test10a(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR4]]
445+
; CGSCC-NEXT: [[R:%.*]] = call align 32 ptr @test10a(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR16:[0-9]+]]
446446
; CGSCC-NEXT: store i32 1, ptr [[R]], align 32
447447
; CGSCC-NEXT: [[G0:%.*]] = getelementptr i32, ptr [[P]], i32 8
448448
; CGSCC-NEXT: br label [[E:%.*]]
@@ -478,14 +478,14 @@ e:
478478
; FIXME: This will work with an upcoming patch (D66618 or similar)
479479
; store i32 -1, ptr %g1, align 32
480480
define ptr @test10b(ptr align 32 %p) {
481-
; TUNIT: Function Attrs: nofree nosync nounwind
481+
; TUNIT: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
482482
; TUNIT-LABEL: define {{[^@]+}}@test10b
483483
; TUNIT-SAME: (ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR3]] {
484484
; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 32
485485
; TUNIT-NEXT: [[C:%.*]] = icmp eq i32 [[L]], 0
486486
; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
487487
; TUNIT: t:
488-
; TUNIT-NEXT: [[R:%.*]] = call align 32 ptr @test10b(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR3]]
488+
; TUNIT-NEXT: [[R:%.*]] = call align 32 ptr @test10b(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR13]]
489489
; TUNIT-NEXT: store i32 1, ptr [[R]], align 32
490490
; TUNIT-NEXT: [[G0:%.*]] = getelementptr i32, ptr [[P]], i32 8
491491
; TUNIT-NEXT: br label [[E:%.*]]
@@ -497,14 +497,14 @@ define ptr @test10b(ptr align 32 %p) {
497497
; TUNIT-NEXT: [[PHI:%.*]] = phi ptr [ [[G0]], [[T]] ], [ [[G1]], [[F]] ]
498498
; TUNIT-NEXT: ret ptr [[PHI]]
499499
;
500-
; CGSCC: Function Attrs: nofree nosync nounwind
500+
; CGSCC: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
501501
; CGSCC-LABEL: define {{[^@]+}}@test10b
502502
; CGSCC-SAME: (ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR4]] {
503503
; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 32
504504
; CGSCC-NEXT: [[C:%.*]] = icmp eq i32 [[L]], 0
505505
; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
506506
; CGSCC: t:
507-
; CGSCC-NEXT: [[R:%.*]] = call align 32 ptr @test10b(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR4]]
507+
; CGSCC-NEXT: [[R:%.*]] = call align 32 ptr @test10b(ptr nofree noundef nonnull align 32 dereferenceable(4) "no-capture-maybe-returned" [[P]]) #[[ATTR16]]
508508
; CGSCC-NEXT: store i32 1, ptr [[R]], align 32
509509
; CGSCC-NEXT: [[G0:%.*]] = getelementptr i32, ptr [[P]], i32 8
510510
; CGSCC-NEXT: br label [[E:%.*]]
@@ -946,7 +946,7 @@ define i32 @musttail_caller_1(ptr %p) {
946946
; TUNIT-NEXT: [[C:%.*]] = load i1, ptr @cnd, align 1
947947
; TUNIT-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
948948
; TUNIT: mt:
949-
; TUNIT-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef readonly [[P]]) #[[ATTR13:[0-9]+]]
949+
; TUNIT-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef readonly [[P]]) #[[ATTR14:[0-9]+]]
950950
; TUNIT-NEXT: ret i32 [[V]]
951951
; TUNIT: exit:
952952
; TUNIT-NEXT: ret i32 0
@@ -957,7 +957,7 @@ define i32 @musttail_caller_1(ptr %p) {
957957
; CGSCC-NEXT: [[C:%.*]] = load i1, ptr @cnd, align 1
958958
; CGSCC-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
959959
; CGSCC: mt:
960-
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR16:[0-9]+]]
960+
; CGSCC-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR17:[0-9]+]]
961961
; CGSCC-NEXT: ret i32 [[V]]
962962
; CGSCC: exit:
963963
; CGSCC-NEXT: ret i32 0
@@ -1089,7 +1089,7 @@ define ptr @aligned_8_return_caller(ptr align(16) %a, i1 %c1, i1 %c2) {
10891089
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
10901090
; TUNIT-LABEL: define {{[^@]+}}@aligned_8_return_caller
10911091
; TUNIT-SAME: (ptr nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR10]] {
1092-
; TUNIT-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 noundef [[C1]], i1 [[C2]]) #[[ATTR14:[0-9]+]]
1092+
; TUNIT-NEXT: [[R:%.*]] = call align 8 ptr @aligned_8_return(ptr noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 noundef [[C1]], i1 [[C2]]) #[[ATTR15:[0-9]+]]
10931093
; TUNIT-NEXT: ret ptr [[R]]
10941094
;
10951095
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
@@ -1221,7 +1221,7 @@ attributes #2 = { null_pointer_is_valid }
12211221
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
12221222
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable }
12231223
; TUNIT: attributes #[[ATTR2]] = { nounwind }
1224-
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind }
1224+
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind memory(argmem: readwrite) }
12251225
; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
12261226
; TUNIT: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
12271227
; TUNIT: attributes #[[ATTR6]] = { nounwind willreturn }
@@ -1231,14 +1231,15 @@ attributes #2 = { null_pointer_is_valid }
12311231
; TUNIT: attributes #[[ATTR10]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
12321232
; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
12331233
; TUNIT: attributes #[[ATTR12]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
1234-
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind willreturn memory(read) }
1235-
; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn }
1234+
; TUNIT: attributes #[[ATTR13]] = { nofree nosync nounwind }
1235+
; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind willreturn memory(read) }
1236+
; TUNIT: attributes #[[ATTR15]] = { nofree nosync nounwind willreturn }
12361237
;.
12371238
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
12381239
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable }
12391240
; CGSCC: attributes #[[ATTR2]] = { noinline nounwind uwtable }
12401241
; CGSCC: attributes #[[ATTR3]] = { nounwind }
1241-
; CGSCC: attributes #[[ATTR4]] = { nofree nosync nounwind }
1242+
; CGSCC: attributes #[[ATTR4]] = { nofree nosync nounwind memory(argmem: readwrite) }
12421243
; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
12431244
; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
12441245
; CGSCC: attributes #[[ATTR7]] = { nounwind willreturn }
@@ -1250,5 +1251,6 @@ attributes #2 = { null_pointer_is_valid }
12501251
; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
12511252
; CGSCC: attributes #[[ATTR14]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }
12521253
; CGSCC: attributes #[[ATTR15]] = { nofree nosync willreturn }
1253-
; CGSCC: attributes #[[ATTR16]] = { nofree willreturn memory(read) }
1254+
; CGSCC: attributes #[[ATTR16]] = { nofree nosync nounwind }
1255+
; CGSCC: attributes #[[ATTR17]] = { nofree willreturn memory(read) }
12541256
;.

llvm/test/Transforms/Attributor/memory_locations.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ define dso_local ptr @internal_only_rec(i32 %arg) {
3535
; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
3636
; CHECK: if.then:
3737
; CHECK-NEXT: [[DIV:%.*]] = sdiv i32 [[ARG]], 2
38-
; CHECK-NEXT: [[CALL:%.*]] = call noalias ptr @internal_only_rec(i32 [[DIV]])
38+
; CHECK-NEXT: [[CALL:%.*]] = call ptr @internal_only_rec(i32 [[DIV]])
3939
; CHECK-NEXT: br label [[RETURN:%.*]]
4040
; CHECK: if.end:
4141
; CHECK-NEXT: [[CONV:%.*]] = sext i32 [[ARG]] to i64

llvm/test/Transforms/Attributor/range.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ define void @test0-icmp-check(ptr %p){
4848
; ret = [0, 10)
4949
; TUNIT-LABEL: define {{[^@]+}}@test0-icmp-check
5050
; TUNIT-SAME: (ptr nocapture nofree readonly align 4 [[P:%.*]]) {
51-
; TUNIT-NEXT: [[RET:%.*]] = tail call i32 @test0(ptr nocapture nofree noundef readonly align 4 [[P]]) #[[ATTR3]], !range [[RNG0]]
51+
; TUNIT-NEXT: [[RET:%.*]] = tail call i32 @test0(ptr nocapture nofree noundef readonly align 4 [[P]]) #[[ATTR3]]
5252
; TUNIT-NEXT: [[CMP_EQ_1:%.*]] = icmp eq i32 [[RET]], 10
5353
; TUNIT-NEXT: [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9
5454
; TUNIT-NEXT: [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8

0 commit comments

Comments
 (0)