Skip to content

Commit 8266d47

Browse files
jdoerfertshiltian
andauthored
[Attributor] Improve AAUnderlyingObjects (#104835)
- Allocas and GlobalValues cannot be simplified, so we should not try. - If we never used any assumed state, the AAUnderlyingObjects doesn't require an additional update. - If we have seen an object (or it's underlying object) before, we do not need to inspect it anymore. The original logic for "SeenObjects" was flawed and caused us to add intermediate values to the underlying object list if a PHI or select instruction referenced the same underlying object twice. The test changes are all instances of this situation and we now correctly derive `memory(none)` for the functions that only access stack memory. --------- Co-authored-by: Shilei Tian <[email protected]>
1 parent 1e1cf25 commit 8266d47

File tree

4 files changed

+71
-81
lines changed

4 files changed

+71
-81
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11904,9 +11904,9 @@ struct AAUnderlyingObjectsImpl
1190411904
ChangeStatus updateImpl(Attributor &A) override {
1190511905
auto &Ptr = getAssociatedValue();
1190611906

11907+
bool UsedAssumedInformation = false;
1190711908
auto DoUpdate = [&](SmallSetVector<Value *, 8> &UnderlyingObjects,
1190811909
AA::ValueScope Scope) {
11909-
bool UsedAssumedInformation = false;
1191011910
SmallPtrSet<Value *, 8> SeenObjects;
1191111911
SmallVector<AA::ValueAndContext> Values;
1191211912

@@ -11920,31 +11920,43 @@ struct AAUnderlyingObjectsImpl
1192011920
auto &VAC = Values[I];
1192111921
auto *Obj = VAC.getValue();
1192211922
Value *UO = getUnderlyingObject(Obj);
11923-
if (UO && UO != VAC.getValue() && SeenObjects.insert(UO).second) {
11923+
if (!SeenObjects.insert(UO ? UO : Obj).second)
11924+
continue;
11925+
if (UO && UO != Obj) {
11926+
if (isa<AllocaInst>(UO) || isa<GlobalValue>(UO)) {
11927+
Changed |= UnderlyingObjects.insert(UO);
11928+
continue;
11929+
}
11930+
1192411931
const auto *OtherAA = A.getAAFor<AAUnderlyingObjects>(
1192511932
*this, IRPosition::value(*UO), DepClassTy::OPTIONAL);
11926-
auto Pred = [&Values](Value &V) {
11927-
Values.emplace_back(V, nullptr);
11933+
auto Pred = [&](Value &V) {
11934+
if (&V == UO)
11935+
Changed |= UnderlyingObjects.insert(UO);
11936+
else
11937+
Values.emplace_back(V, nullptr);
1192811938
return true;
1192911939
};
1193011940

1193111941
if (!OtherAA || !OtherAA->forallUnderlyingObjects(Pred, Scope))
1193211942
llvm_unreachable(
1193311943
"The forall call should not return false at this position");
11934-
11944+
UsedAssumedInformation |= !OtherAA->getState().isAtFixpoint();
1193511945
continue;
1193611946
}
1193711947

1193811948
if (isa<SelectInst>(Obj)) {
11939-
Changed |= handleIndirect(A, *Obj, UnderlyingObjects, Scope);
11949+
Changed |= handleIndirect(A, *Obj, UnderlyingObjects, Scope,
11950+
UsedAssumedInformation);
1194011951
continue;
1194111952
}
1194211953
if (auto *PHI = dyn_cast<PHINode>(Obj)) {
1194311954
// Explicitly look through PHIs as we do not care about dynamically
1194411955
// uniqueness.
1194511956
for (unsigned u = 0, e = PHI->getNumIncomingValues(); u < e; u++) {
11946-
Changed |= handleIndirect(A, *PHI->getIncomingValue(u),
11947-
UnderlyingObjects, Scope);
11957+
Changed |=
11958+
handleIndirect(A, *PHI->getIncomingValue(u), UnderlyingObjects,
11959+
Scope, UsedAssumedInformation);
1194811960
}
1194911961
continue;
1195011962
}
@@ -11958,7 +11970,8 @@ struct AAUnderlyingObjectsImpl
1195811970
bool Changed = false;
1195911971
Changed |= DoUpdate(IntraAssumedUnderlyingObjects, AA::Intraprocedural);
1196011972
Changed |= DoUpdate(InterAssumedUnderlyingObjects, AA::Interprocedural);
11961-
11973+
if (!UsedAssumedInformation)
11974+
indicateOptimisticFixpoint();
1196211975
return Changed ? ChangeStatus::CHANGED : ChangeStatus::UNCHANGED;
1196311976
}
1196411977

@@ -11983,7 +11996,7 @@ struct AAUnderlyingObjectsImpl
1198311996
/// as a phi node or a select instruction.
1198411997
bool handleIndirect(Attributor &A, Value &V,
1198511998
SmallSetVector<Value *, 8> &UnderlyingObjects,
11986-
AA::ValueScope Scope) {
11999+
AA::ValueScope Scope, bool &UsedAssumedInformation) {
1198712000
bool Changed = false;
1198812001
const auto *AA = A.getAAFor<AAUnderlyingObjects>(
1198912002
*this, IRPosition::value(V), DepClassTy::OPTIONAL);
@@ -11994,6 +12007,7 @@ struct AAUnderlyingObjectsImpl
1199412007
if (!AA || !AA->forallUnderlyingObjects(Pred, Scope))
1199512008
llvm_unreachable(
1199612009
"The forall call should not return false at this position");
12010+
UsedAssumedInformation |= !AA->getState().isAtFixpoint();
1199712011
return Changed;
1199812012
}
1199912013

llvm/test/Transforms/Attributor/call-simplify-pointer-info.ll

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ define i8 @call_simplifiable_1() {
4747
; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
4848
; CGSCC-NEXT: [[I0:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 2
4949
; CGSCC-NEXT: store i8 2, ptr [[I0]], align 2
50-
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]]) #[[ATTR4:[0-9]+]]
50+
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]]) #[[ATTR3:[0-9]+]]
5151
; CGSCC-NEXT: ret i8 [[R]]
5252
;
5353
entry:
@@ -77,8 +77,8 @@ define internal i8 @sum_two_same_loads(ptr %p) {
7777
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
7878
; CGSCC-LABEL: define {{[^@]+}}@sum_two_same_loads
7979
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P:%.*]]) #[[ATTR2:[0-9]+]] {
80-
; CGSCC-NEXT: [[X:%.*]] = call i8 @read_arg_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR4]]
81-
; CGSCC-NEXT: [[Y:%.*]] = call i8 @read_arg_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR4]]
80+
; CGSCC-NEXT: [[X:%.*]] = call i8 @read_arg_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR3]]
81+
; CGSCC-NEXT: [[Y:%.*]] = call i8 @read_arg_1(ptr nocapture nofree noundef nonnull readonly dereferenceable(1022) [[P]]) #[[ATTR3]]
8282
; CGSCC-NEXT: [[Z:%.*]] = add nsw i8 [[X]], [[Y]]
8383
; CGSCC-NEXT: ret i8 [[Z]]
8484
;
@@ -107,7 +107,7 @@ define i8 @call_simplifiable_2() {
107107
; CGSCC-NEXT: store i8 2, ptr [[I0]], align 2
108108
; CGSCC-NEXT: [[I1:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 3
109109
; CGSCC-NEXT: store i8 3, ptr [[I1]], align 1
110-
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_same_loads(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]]) #[[ATTR4]]
110+
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_same_loads(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I0]]) #[[ATTR3]]
111111
; CGSCC-NEXT: ret i8 [[R]]
112112
;
113113
entry:
@@ -136,7 +136,7 @@ define i8 @call_simplifiable_3() {
136136
; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
137137
; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 2
138138
; CGSCC-NEXT: store i8 2, ptr [[I2]], align 2
139-
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg_index(ptr nocapture nofree noundef nonnull readonly align 16 dereferenceable(1024) [[BYTES]]) #[[ATTR4]]
139+
; CGSCC-NEXT: [[R:%.*]] = call i8 @read_arg_index(ptr nocapture nofree noundef nonnull readonly align 16 dereferenceable(1024) [[BYTES]]) #[[ATTR3]]
140140
; CGSCC-NEXT: ret i8 [[R]]
141141
;
142142
entry:
@@ -174,16 +174,16 @@ define internal i8 @sum_two_different_loads(ptr %p, ptr %q) {
174174
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
175175
; TUNIT-LABEL: define {{[^@]+}}@sum_two_different_loads
176176
; TUNIT-SAME: (ptr nocapture nofree nonnull readonly dereferenceable(972) [[P:%.*]], ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[Q:%.*]]) #[[ATTR1]] {
177-
; TUNIT-NEXT: [[X:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[P]]) #[[ATTR3:[0-9]+]]
178-
; TUNIT-NEXT: [[Y:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[Q]]) #[[ATTR3]]
177+
; TUNIT-NEXT: [[X:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[P]]) #[[ATTR2:[0-9]+]]
178+
; TUNIT-NEXT: [[Y:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[Q]]) #[[ATTR2]]
179179
; TUNIT-NEXT: [[Z:%.*]] = add nsw i8 [[X]], [[Y]]
180180
; TUNIT-NEXT: ret i8 [[Z]]
181181
;
182182
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read)
183183
; CGSCC-LABEL: define {{[^@]+}}@sum_two_different_loads
184184
; CGSCC-SAME: (ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[P:%.*]], ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[Q:%.*]]) #[[ATTR2]] {
185-
; CGSCC-NEXT: [[X:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[P]]) #[[ATTR4]]
186-
; CGSCC-NEXT: [[Y:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[Q]]) #[[ATTR4]]
185+
; CGSCC-NEXT: [[X:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[P]]) #[[ATTR3]]
186+
; CGSCC-NEXT: [[Y:%.*]] = call i8 @read_arg_2(ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[Q]]) #[[ATTR3]]
187187
; CGSCC-NEXT: [[Z:%.*]] = add nsw i8 [[X]], [[Y]]
188188
; CGSCC-NEXT: ret i8 [[Z]]
189189
;
@@ -204,7 +204,7 @@ define i8 @call_partially_simplifiable_1() {
204204
; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 3
205205
; TUNIT-NEXT: store i8 3, ptr [[I3]], align 1
206206
; TUNIT-NEXT: [[I4:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 4
207-
; TUNIT-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I2]], ptr nocapture nofree noundef nonnull readonly dereferenceable(1021) [[I3]]) #[[ATTR3]]
207+
; TUNIT-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I2]], ptr nocapture nofree noundef nonnull readonly dereferenceable(1021) [[I3]]) #[[ATTR3:[0-9]+]]
208208
; TUNIT-NEXT: ret i8 [[R]]
209209
;
210210
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
@@ -218,7 +218,7 @@ define i8 @call_partially_simplifiable_1() {
218218
; CGSCC-NEXT: store i8 3, ptr [[I3]], align 1
219219
; CGSCC-NEXT: [[I4:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 4
220220
; CGSCC-NEXT: store i8 4, ptr [[I4]], align 4
221-
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I2]], ptr nocapture nofree noundef nonnull readonly dereferenceable(1021) [[I3]]) #[[ATTR4]]
221+
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree noundef nonnull readonly align 2 dereferenceable(1022) [[I2]], ptr nocapture nofree noundef nonnull readonly dereferenceable(1021) [[I3]]) #[[ATTR3]]
222222
; CGSCC-NEXT: ret i8 [[R]]
223223
;
224224
entry:
@@ -235,9 +235,9 @@ entry:
235235
}
236236

237237
define i8 @call_partially_simplifiable_2(i1 %cond) {
238-
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
238+
; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
239239
; TUNIT-LABEL: define {{[^@]+}}@call_partially_simplifiable_2
240-
; TUNIT-SAME: (i1 [[COND:%.*]]) #[[ATTR2:[0-9]+]] {
240+
; TUNIT-SAME: (i1 [[COND:%.*]]) #[[ATTR0]] {
241241
; TUNIT-NEXT: entry:
242242
; TUNIT-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
243243
; TUNIT-NEXT: [[I51:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 51
@@ -250,9 +250,9 @@ define i8 @call_partially_simplifiable_2(i1 %cond) {
250250
; TUNIT-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree nonnull readonly dereferenceable(972) [[SEL]], ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[I53]]) #[[ATTR3]]
251251
; TUNIT-NEXT: ret i8 [[R]]
252252
;
253-
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
253+
; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
254254
; CGSCC-LABEL: define {{[^@]+}}@call_partially_simplifiable_2
255-
; CGSCC-SAME: (i1 [[COND:%.*]]) #[[ATTR3:[0-9]+]] {
255+
; CGSCC-SAME: (i1 [[COND:%.*]]) #[[ATTR1]] {
256256
; CGSCC-NEXT: entry:
257257
; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
258258
; CGSCC-NEXT: [[I51:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 51
@@ -263,7 +263,7 @@ define i8 @call_partially_simplifiable_2(i1 %cond) {
263263
; CGSCC-NEXT: [[I54:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 54
264264
; CGSCC-NEXT: store i8 4, ptr [[I54]], align 2
265265
; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[COND]], ptr [[I51]], ptr [[I52]]
266-
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[SEL]], ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[I53]]) #[[ATTR4]]
266+
; CGSCC-NEXT: [[R:%.*]] = call i8 @sum_two_different_loads(ptr nocapture nofree noundef nonnull readonly dereferenceable(972) [[SEL]], ptr nocapture nofree noundef nonnull readonly dereferenceable(971) [[I53]]) #[[ATTR3]]
267267
; CGSCC-NEXT: ret i8 [[R]]
268268
;
269269
entry:
@@ -284,12 +284,11 @@ entry:
284284
;.
285285
; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
286286
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
287-
; TUNIT: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn }
288-
; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn memory(read) }
287+
; TUNIT: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(read) }
288+
; TUNIT: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn memory(read) }
289289
;.
290290
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
291291
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
292292
; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: read) }
293-
; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree nosync nounwind willreturn }
294-
; CGSCC: attributes #[[ATTR4]] = { nofree willreturn memory(read) }
293+
; CGSCC: attributes #[[ATTR3]] = { nofree willreturn memory(read) }
295294
;.

llvm/test/Transforms/Attributor/multiple-offsets-pointer-info.ll

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,14 @@ entry:
267267
}
268268

269269
define i8 @select_gep_simplifiable_1(i1 %cnd1, i1 %cnd2) {
270-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
270+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
271271
; CHECK-LABEL: define {{[^@]+}}@select_gep_simplifiable_1
272-
; CHECK-SAME: (i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR2:[0-9]+]] {
272+
; CHECK-SAME: (i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR1]] {
273273
; CHECK-NEXT: entry:
274274
; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
275275
; CHECK-NEXT: [[GEP7:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 7
276276
; CHECK-NEXT: [[GEP23:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 23
277277
; CHECK-NEXT: [[SEL_PTR:%.*]] = select i1 [[CND1]], ptr [[GEP7]], ptr [[GEP23]]
278-
; CHECK-NEXT: store i8 42, ptr [[SEL_PTR]], align 4
279278
; CHECK-NEXT: ret i8 21
280279
;
281280
entry:
@@ -291,9 +290,9 @@ entry:
291290
}
292291

293292
define i8 @select_gep_not_simplifiable_1(i1 %cnd1, i1 %cnd2) {
294-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
293+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
295294
; CHECK-LABEL: define {{[^@]+}}@select_gep_not_simplifiable_1
296-
; CHECK-SAME: (i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR3:[0-9]+]] {
295+
; CHECK-SAME: (i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR1]] {
297296
; CHECK-NEXT: entry:
298297
; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
299298
; CHECK-NEXT: [[GEP7:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 7
@@ -318,9 +317,9 @@ entry:
318317
; FIXME: The whole function is just "ret i8 21".
319318

320319
define i8 @phi_gep_simplifiable_1(i1 %cnd1, i1 %cnd2) {
321-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
320+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
322321
; CHECK-LABEL: define {{[^@]+}}@phi_gep_simplifiable_1
323-
; CHECK-SAME: (i1 noundef [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR3]] {
322+
; CHECK-SAME: (i1 noundef [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR1]] {
324323
; CHECK-NEXT: entry:
325324
; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
326325
; CHECK-NEXT: br i1 [[CND1]], label [[THEN:%.*]], label [[ELSE:%.*]]
@@ -364,9 +363,9 @@ join:
364363
; FIXME: The whole function is just "ret i8 42".
365364

366365
define i8 @phi_gep_simplifiable_2(i1 %cnd1, i1 %cnd2) {
367-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
366+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
368367
; CHECK-LABEL: define {{[^@]+}}@phi_gep_simplifiable_2
369-
; CHECK-SAME: (i1 noundef [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR2]] {
368+
; CHECK-SAME: (i1 noundef [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR1]] {
370369
; CHECK-NEXT: entry:
371370
; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
372371
; CHECK-NEXT: br i1 [[CND1]], label [[THEN:%.*]], label [[ELSE:%.*]]
@@ -378,7 +377,6 @@ define i8 @phi_gep_simplifiable_2(i1 %cnd1, i1 %cnd2) {
378377
; CHECK-NEXT: br label [[JOIN]]
379378
; CHECK: join:
380379
; CHECK-NEXT: [[PHI_PTR:%.*]] = phi ptr [ [[GEP23]], [[THEN]] ], [ [[GEP31]], [[ELSE]] ]
381-
; CHECK-NEXT: store i8 21, ptr [[PHI_PTR]], align 4
382380
; CHECK-NEXT: ret i8 42
383381
;
384382
entry:
@@ -405,9 +403,9 @@ join:
405403
}
406404

407405
define i8 @phi_gep_not_simplifiable_1(i1 %cnd1, i1 %cnd2) {
408-
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
406+
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
409407
; CHECK-LABEL: define {{[^@]+}}@phi_gep_not_simplifiable_1
410-
; CHECK-SAME: (i1 noundef [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR3]] {
408+
; CHECK-SAME: (i1 noundef [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR1]] {
411409
; CHECK-NEXT: entry:
412410
; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
413411
; CHECK-NEXT: [[GEP23:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 23
@@ -518,8 +516,6 @@ join:
518516
;.
519517
; CHECK: attributes #[[ATTR0:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" }
520518
; CHECK: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
521-
; CHECK: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
522-
; CHECK: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn }
523519
;.
524520
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
525521
; CGSCC: {{.*}}

0 commit comments

Comments
 (0)