Skip to content

Commit 0bb1b68

Browse files
authored
[Local] Only intersect tbaa metadata if instr moves. (#116682)
Preserve tbaa metadata on the replacement instruction, if it does not move. In that case, the program would be UB, if the aliasing property encoded in the metadata does not hold. This makes use of the clarification re tbaa metadata implying UB if the property does not hold: #116220 Same as #115868, but for !tbaa PR: #116682
1 parent c0efcc0 commit 0bb1b68

File tree

6 files changed

+116
-72
lines changed

6 files changed

+116
-72
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3326,7 +3326,8 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J,
33263326
K->mergeDIAssignID(J);
33273327
break;
33283328
case LLVMContext::MD_tbaa:
3329-
K->setMetadata(Kind, MDNode::getMostGenericTBAA(JMD, KMD));
3329+
if (DoesKMove)
3330+
K->setMetadata(Kind, MDNode::getMostGenericTBAA(JMD, KMD));
33303331
break;
33313332
case LLVMContext::MD_alias_scope:
33323333
K->setMetadata(Kind, MDNode::getMostGenericAliasScope(JMD, KMD));

llvm/test/Transforms/GVN/tbaa.ll

Lines changed: 75 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,103 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
12
; RUN: opt -passes=gvn -S < %s | FileCheck %s
23

34
define i32 @test1(ptr %p, ptr %q) {
4-
; CHECK-LABEL: @test1(ptr %p, ptr %q)
5-
; CHECK: call i32 @foo(ptr %p)
6-
; CHECK-NOT: tbaa
7-
; CHECK: %c = add i32 %a, %a
5+
; CHECK-LABEL: define i32 @test1(
6+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
7+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0:![0-9]+]]
8+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
9+
; CHECK-NEXT: ret i32 [[C]]
10+
;
811
%a = call i32 @foo(ptr %p), !tbaa !0
912
%b = call i32 @foo(ptr %p)
1013
%c = add i32 %a, %b
1114
ret i32 %c
1215
}
1316

1417
define i32 @test2(ptr %p, ptr %q) {
15-
; CHECK-LABEL: @test2(ptr %p, ptr %q)
16-
; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGC:!.*]]
17-
; CHECK: %c = add i32 %a, %a
18+
; CHECK-LABEL: define i32 @test2(
19+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
20+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0]]
21+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
22+
; CHECK-NEXT: ret i32 [[C]]
23+
;
1824
%a = call i32 @foo(ptr %p), !tbaa !0
1925
%b = call i32 @foo(ptr %p), !tbaa !0
2026
%c = add i32 %a, %b
2127
ret i32 %c
2228
}
2329

2430
define i32 @test3(ptr %p, ptr %q) {
25-
; CHECK-LABEL: @test3(ptr %p, ptr %q)
26-
; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGB:!.*]]
27-
; CHECK: %c = add i32 %a, %a
31+
; CHECK-LABEL: define i32 @test3(
32+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
33+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA4:![0-9]+]]
34+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
35+
; CHECK-NEXT: ret i32 [[C]]
36+
;
2837
%a = call i32 @foo(ptr %p), !tbaa !3
2938
%b = call i32 @foo(ptr %p), !tbaa !3
3039
%c = add i32 %a, %b
3140
ret i32 %c
3241
}
3342

3443
define i32 @test4(ptr %p, ptr %q) {
35-
; CHECK-LABEL: @test4(ptr %p, ptr %q)
36-
; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGA:!.*]]
37-
; CHECK: %c = add i32 %a, %a
44+
; CHECK-LABEL: define i32 @test4(
45+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
46+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA6:![0-9]+]]
47+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
48+
; CHECK-NEXT: ret i32 [[C]]
49+
;
3850
%a = call i32 @foo(ptr %p), !tbaa !1
3951
%b = call i32 @foo(ptr %p), !tbaa !0
4052
%c = add i32 %a, %b
4153
ret i32 %c
4254
}
4355

4456
define i32 @test5(ptr %p, ptr %q) {
45-
; CHECK-LABEL: @test5(ptr %p, ptr %q)
46-
; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGA]]
47-
; CHECK: %c = add i32 %a, %a
57+
; CHECK-LABEL: define i32 @test5(
58+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
59+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0]]
60+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
61+
; CHECK-NEXT: ret i32 [[C]]
62+
;
4863
%a = call i32 @foo(ptr %p), !tbaa !0
4964
%b = call i32 @foo(ptr %p), !tbaa !1
5065
%c = add i32 %a, %b
5166
ret i32 %c
5267
}
5368

5469
define i32 @test6(ptr %p, ptr %q) {
55-
; CHECK-LABEL: @test6(ptr %p, ptr %q)
56-
; CHECK: call i32 @foo(ptr %p), !tbaa [[TAGA]]
57-
; CHECK: %c = add i32 %a, %a
70+
; CHECK-LABEL: define i32 @test6(
71+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
72+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0]]
73+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
74+
; CHECK-NEXT: ret i32 [[C]]
75+
;
5876
%a = call i32 @foo(ptr %p), !tbaa !0
5977
%b = call i32 @foo(ptr %p), !tbaa !3
6078
%c = add i32 %a, %b
6179
ret i32 %c
6280
}
6381

6482
define i32 @test7(ptr %p, ptr %q) {
65-
; CHECK-LABEL: @test7(ptr %p, ptr %q)
66-
; CHECK: call i32 @foo(ptr %p)
67-
; CHECK-NOT: tbaa
68-
; CHECK: %c = add i32 %a, %a
83+
; CHECK-LABEL: define i32 @test7(
84+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
85+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA7:![0-9]+]]
86+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
87+
; CHECK-NEXT: ret i32 [[C]]
88+
;
6989
%a = call i32 @foo(ptr %p), !tbaa !4
7090
%b = call i32 @foo(ptr %p), !tbaa !3
7191
%c = add i32 %a, %b
7292
ret i32 %c
7393
}
7494

7595
define i32 @test8(ptr %p, ptr %q) {
76-
; CHECK-LABEL: @test8
77-
; CHECK-NEXT: store i32 15, ptr %p
78-
; CHECK-NEXT: ret i32 0
96+
; CHECK-LABEL: define i32 @test8(
97+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
98+
; CHECK-NEXT: store i32 15, ptr [[P]], align 4
99+
; CHECK-NEXT: ret i32 0
100+
;
79101
; Since we know the location is invariant, we can forward the
80102
; load across the potentially aliasing store.
81103

@@ -87,9 +109,11 @@ define i32 @test8(ptr %p, ptr %q) {
87109
}
88110

89111
define i32 @test9(ptr %p, ptr %q) {
90-
; CHECK-LABEL: @test9
91-
; CHECK-NEXT: call void @clobber()
92-
; CHECK-NEXT: ret i32 0
112+
; CHECK-LABEL: define i32 @test9(
113+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
114+
; CHECK-NEXT: call void @clobber()
115+
; CHECK-NEXT: ret i32 0
116+
;
93117
; Since we know the location is invariant, we can forward the
94118
; load across the potentially aliasing store (within the call).
95119

@@ -103,9 +127,12 @@ define i32 @test9(ptr %p, ptr %q) {
103127
define i32 @test10(ptr %p, ptr %q) {
104128
; If one access encloses the other, then the merged access is the enclosed one
105129
; and not just the common final access type.
106-
; CHECK-LABEL: @test10
107-
; CHECK: call i32 @foo(ptr %p), !tbaa [[TAG_X_i:!.*]]
108-
; CHECK: %c = add i32 %a, %a
130+
; CHECK-LABEL: define i32 @test10(
131+
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
132+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA10:![0-9]+]]
133+
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
134+
; CHECK-NEXT: ret i32 [[C]]
135+
;
109136
%a = call i32 @foo(ptr %p), !tbaa !15 ; TAG_X_i
110137
%b = call i32 @foo(ptr %p), !tbaa !19 ; TAG_Y_x_i
111138
%c = add i32 %a, %b
@@ -115,12 +142,6 @@ define i32 @test10(ptr %p, ptr %q) {
115142
declare void @clobber()
116143
declare i32 @foo(ptr) readonly
117144

118-
; CHECK-DAG: [[TAGC]] = !{[[TYPEC:!.*]], [[TYPEC]], i64 0}
119-
; CHECK-DAG: [[TYPEC]] = !{!"C", [[TYPEA:!.*]]}
120-
; CHECK-DAG: [[TYPEA]] = !{!"A", !{{.*}}}
121-
; CHECK-DAG: [[TAGB]] = !{[[TYPEB:!.*]], [[TYPEB]], i64 0}
122-
; CHECK-DAG: [[TYPEB]] = !{!"B", [[TYPEA]]}
123-
; CHECK-DAG: [[TAGA]] = !{[[TYPEA]], [[TYPEA]], i64 0}
124145
!0 = !{!5, !5, i64 0}
125146
!1 = !{!6, !6, i64 0}
126147
!2 = !{!"tbaa root"}
@@ -132,9 +153,6 @@ declare i32 @foo(ptr) readonly
132153
!8 = !{!"another root"}
133154
!11 = !{!"scalar type", !8}
134155

135-
; CHECK-DAG: [[TAG_X_i]] = !{[[TYPE_X:!.*]], [[TYPE_int:!.*]], i64 0}
136-
; CHECK-DAG: [[TYPE_X:!.*]] = !{!"struct X", [[TYPE_int]], i64 0}
137-
; CHECK-DAG: [[TYPE_int]] = !{!"int", {{!.*}}, i64 0}
138156
!15 = !{!16, !17, i64 0} ; TAG_X_i
139157
!16 = !{!"struct X", !17, i64 0} ; struct X { int i; };
140158
!17 = !{!"int", !18, i64 0}
@@ -146,3 +164,19 @@ declare i32 @foo(ptr) readonly
146164
; A TBAA structure who's only point is to have a constant location.
147165
!9 = !{!"yet another root"}
148166
!10 = !{!"node", !9, i64 1}
167+
;.
168+
; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0}
169+
; CHECK: [[META1]] = !{!"C", [[META2:![0-9]+]]}
170+
; CHECK: [[META2]] = !{!"A", [[META3:![0-9]+]]}
171+
; CHECK: [[META3]] = !{!"tbaa root"}
172+
; CHECK: [[TBAA4]] = !{[[META5:![0-9]+]], [[META5]], i64 0}
173+
; CHECK: [[META5]] = !{!"B", [[META2]]}
174+
; CHECK: [[TBAA6]] = !{[[META2]], [[META2]], i64 0}
175+
; CHECK: [[TBAA7]] = !{[[META8:![0-9]+]], [[META8]], i64 0}
176+
; CHECK: [[META8]] = !{!"scalar type", [[META9:![0-9]+]]}
177+
; CHECK: [[META9]] = !{!"another root"}
178+
; CHECK: [[TBAA10]] = !{[[META11:![0-9]+]], [[META12:![0-9]+]], i64 0}
179+
; CHECK: [[META11]] = !{!"struct X", [[META12]], i64 0}
180+
; CHECK: [[META12]] = !{!"int", [[META13:![0-9]+]], i64 0}
181+
; CHECK: [[META13]] = !{!"char", [[META3]], i64 0}
182+
;.

llvm/test/Transforms/InstCombine/loadstore-metadata.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ entry:
204204
define double @preserve_load_metadata_after_select_transform2(ptr %a, ptr %b) {
205205
; CHECK-LABEL: @preserve_load_metadata_after_select_transform2(
206206
; CHECK-NEXT: entry:
207-
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !llvm.access.group [[META6]]
208-
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !llvm.access.group [[META6]]
207+
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[META6]]
208+
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[META6]]
209209
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp fast olt double [[L_A]], [[L_B]]
210210
; CHECK-NEXT: [[L_SEL:%.*]] = select i1 [[CMP_I]], double [[L_B]], double [[L_A]]
211211
; CHECK-NEXT: ret double [[L_SEL]]
@@ -223,7 +223,7 @@ define double @preserve_load_metadata_after_select_transform_metadata_missing_1(
223223
; CHECK-LABEL: @preserve_load_metadata_after_select_transform_metadata_missing_1(
224224
; CHECK-NEXT: entry:
225225
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !llvm.access.group [[META6]]
226-
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !llvm.access.group [[META6]]
226+
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[META6]]
227227
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp fast olt double [[L_A]], [[L_B]]
228228
; CHECK-NEXT: [[L_SEL:%.*]] = select i1 [[CMP_I]], double [[L_B]], double [[L_A]]
229229
; CHECK-NEXT: ret double [[L_SEL]]
@@ -258,8 +258,8 @@ entry:
258258
define double @preserve_load_metadata_after_select_transform_metadata_missing_3(ptr %a, ptr %b) {
259259
; CHECK-LABEL: @preserve_load_metadata_after_select_transform_metadata_missing_3(
260260
; CHECK-NEXT: entry:
261-
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !llvm.access.group [[META6]]
262-
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !llvm.access.group [[META6]]
261+
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[META6]]
262+
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[META6]]
263263
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp fast olt double [[L_A]], [[L_B]]
264264
; CHECK-NEXT: [[L_SEL:%.*]] = select i1 [[CMP_I]], double [[L_B]], double [[L_A]]
265265
; CHECK-NEXT: ret double [[L_SEL]]
@@ -278,8 +278,8 @@ entry:
278278
define double @preserve_load_metadata_after_select_transform_metadata_missing_4(ptr %a, ptr %b) {
279279
; CHECK-LABEL: @preserve_load_metadata_after_select_transform_metadata_missing_4(
280280
; CHECK-NEXT: entry:
281-
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !llvm.access.group [[META6]]
282-
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !llvm.access.group [[ACC_GRP10:![0-9]+]]
281+
; CHECK-NEXT: [[L_A:%.*]] = load double, ptr [[A:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[META6]]
282+
; CHECK-NEXT: [[L_B:%.*]] = load double, ptr [[B:%.*]], align 8, !tbaa [[TBAA0]], !llvm.access.group [[ACC_GRP10:![0-9]+]]
283283
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp fast olt double [[L_A]], [[L_B]]
284284
; CHECK-NEXT: [[L_SEL:%.*]] = select i1 [[CMP_I]], double [[L_B]], double [[L_A]]
285285
; CHECK-NEXT: ret double [[L_SEL]]

llvm/test/Transforms/JumpThreading/thread-loads.ll

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals smart
22
; RUN: opt < %s -passes=jump-threading -S | FileCheck %s
33
; RUN: opt < %s -aa-pipeline=basic-aa -passes=jump-threading -S | FileCheck %s
44

@@ -316,13 +316,12 @@ bb3:
316316
ret i32 %res.0
317317
}
318318

319-
; Make sure we merge the aliasing metadata. We keep the range metadata for the
320-
; first load, as it dominates the second load. Hence we can eliminate the
321-
; branch.
319+
; We keep the tbaa and range metadata for the first load, as it dominates the
320+
; second load. Hence we can eliminate the branch.
322321
define void @test8(ptr, ptr, ptr) {
323322
; CHECK-LABEL: @test8(
324323
; CHECK-NEXT: ret2:
325-
; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[TMP0:%.*]], align 4, !range [[RNG4:![0-9]+]], !noundef !5
324+
; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[TMP0:%.*]], align 4, !tbaa [[TBAA0]], !range [[RNG4:![0-9]+]], !noundef [[META5:![0-9]+]]
326325
; CHECK-NEXT: store i32 [[A]], ptr [[TMP1:%.*]], align 4
327326
; CHECK-NEXT: [[XXX:%.*]] = tail call i32 (...) @f1() #[[ATTR0]]
328327
; CHECK-NEXT: ret void
@@ -455,8 +454,8 @@ define fastcc i32 @Search(i64 %idxprom.i, i64 %idxprom.i89, i32 %c) {
455454
; CHECK-NEXT: [[ARRAYIDX89:%.*]] = getelementptr inbounds [65 x ptr], ptr @last, i64 0, i64 [[IDXPROM_I]]
456455
; CHECK-NEXT: [[PHASE:%.*]] = getelementptr inbounds [65 x %struct.NEXT_MOVE], ptr @next_status, i64 0, i64 [[IDXPROM_I]], i32 0
457456
; CHECK-NEXT: switch i32 [[C:%.*]], label [[CLEANUP:%.*]] [
458-
; CHECK-NEXT: i32 1, label [[SW_BB_I:%.*]]
459-
; CHECK-NEXT: i32 0, label [[SW_BB21_I:%.*]]
457+
; CHECK-NEXT: i32 1, label [[SW_BB_I:%.*]]
458+
; CHECK-NEXT: i32 0, label [[SW_BB21_I:%.*]]
460459
; CHECK-NEXT: ]
461460
; CHECK: sw.bb.i:
462461
; CHECK-NEXT: [[CALL_I62:%.*]] = call fastcc ptr @GenerateCheckEvasions()
@@ -680,7 +679,6 @@ right_x:
680679
}
681680

682681

683-
; CHECK: [[RNG4]] = !{i32 0, i32 1}
684682

685683
!0 = !{!3, !3, i64 0}
686684
!1 = !{!"omnipotent char", !2}
@@ -694,3 +692,11 @@ right_x:
694692
!9 = !{!7}
695693
!10 = !{!8}
696694
!11 = !{}
695+
;.
696+
; CHECK: [[TBAA0]] = !{[[META1:![0-9]+]], [[META1]], i64 0}
697+
; CHECK: [[META1]] = !{!"int", [[META2:![0-9]+]]}
698+
; CHECK: [[META2]] = !{!"omnipotent char", [[META3:![0-9]+]]}
699+
; CHECK: [[META3]] = !{!"Simple C/C++ TBAA"}
700+
; CHECK: [[RNG4]] = !{i32 0, i32 1}
701+
; CHECK: [[META5]] = !{}
702+
;.

llvm/test/Transforms/NewGVN/tbaa.ll

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
define i32 @test1(ptr %p, ptr %q) {
55
; CHECK-LABEL: define i32 @test1(
66
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
7-
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]])
7+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0:![0-9]+]]
88
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
99
; CHECK-NEXT: ret i32 [[C]]
1010
;
@@ -17,7 +17,7 @@ define i32 @test1(ptr %p, ptr %q) {
1717
define i32 @test2(ptr %p, ptr %q) {
1818
; CHECK-LABEL: define i32 @test2(
1919
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
20-
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0:![0-9]+]]
20+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0]]
2121
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
2222
; CHECK-NEXT: ret i32 [[C]]
2323
;
@@ -56,7 +56,7 @@ define i32 @test4(ptr %p, ptr %q) {
5656
define i32 @test5(ptr %p, ptr %q) {
5757
; CHECK-LABEL: define i32 @test5(
5858
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
59-
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA6]]
59+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0]]
6060
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
6161
; CHECK-NEXT: ret i32 [[C]]
6262
;
@@ -69,7 +69,7 @@ define i32 @test5(ptr %p, ptr %q) {
6969
define i32 @test6(ptr %p, ptr %q) {
7070
; CHECK-LABEL: define i32 @test6(
7171
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
72-
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA6]]
72+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA0]]
7373
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
7474
; CHECK-NEXT: ret i32 [[C]]
7575
;
@@ -82,7 +82,7 @@ define i32 @test6(ptr %p, ptr %q) {
8282
define i32 @test7(ptr %p, ptr %q) {
8383
; CHECK-LABEL: define i32 @test7(
8484
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
85-
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]])
85+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA7:![0-9]+]]
8686
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
8787
; CHECK-NEXT: ret i32 [[C]]
8888
;
@@ -129,7 +129,7 @@ define i32 @test10(ptr %p, ptr %q) {
129129
; and not just the common final access type.
130130
; CHECK-LABEL: define i32 @test10(
131131
; CHECK-SAME: ptr [[P:%.*]], ptr [[Q:%.*]]) {
132-
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA7:![0-9]+]]
132+
; CHECK-NEXT: [[A:%.*]] = call i32 @foo(ptr [[P]]), !tbaa [[TBAA10:![0-9]+]]
133133
; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
134134
; CHECK-NEXT: ret i32 [[C]]
135135
;
@@ -172,8 +172,11 @@ declare i32 @foo(ptr) readonly
172172
; CHECK: [[TBAA4]] = !{[[META5:![0-9]+]], [[META5]], i64 0}
173173
; CHECK: [[META5]] = !{!"B", [[META2]]}
174174
; CHECK: [[TBAA6]] = !{[[META2]], [[META2]], i64 0}
175-
; CHECK: [[TBAA7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], i64 0}
176-
; CHECK: [[META8]] = !{!"struct X", [[META9]], i64 0}
177-
; CHECK: [[META9]] = !{!"int", [[META10:![0-9]+]], i64 0}
178-
; CHECK: [[META10]] = !{!"char", [[META3]], i64 0}
175+
; CHECK: [[TBAA7]] = !{[[META8:![0-9]+]], [[META8]], i64 0}
176+
; CHECK: [[META8]] = !{!"scalar type", [[META9:![0-9]+]]}
177+
; CHECK: [[META9]] = !{!"another root"}
178+
; CHECK: [[TBAA10]] = !{[[META11:![0-9]+]], [[META12:![0-9]+]], i64 0}
179+
; CHECK: [[META11]] = !{!"struct X", [[META12]], i64 0}
180+
; CHECK: [[META12]] = !{!"int", [[META13:![0-9]+]], i64 0}
181+
; CHECK: [[META13]] = !{!"char", [[META3]], i64 0}
179182
;.

0 commit comments

Comments
 (0)