22
33;; Modified from llvm/test/Transforms/JumpThreading/thread-two-bbs.ll
44;;
5- ;; JumpThreading duplicates bb.cond2 to thread through bb.file to bb.f2 or exit.
5+ ;; JumpThreading duplicates bb.cond2 to thread through bb.file to bb.file,
6+ ;; bb.f2 or exit.
67;;
78;; Check the duplicated instructions get remapped atom groups.
89
910; CHECK: bb.cond2:
1011; CHECK-NEXT: call void @f1()
1112; CHECK-NEXT: %tobool1 = icmp eq i32 %cond2, 0, !dbg [[G1R2:!.*]]
12- ; CHECK-NEXT: br i1 %tobool1, label %exit , label %exit, !dbg [[G1R1:!.*]]
13+ ; CHECK-NEXT: br i1 %tobool1, label %bb.file , label %exit, !dbg [[G1R1:!.*]]
1314
1415; CHECK: bb.cond2.thread:
15- ; CHECK-NEXT: %tobool12 = icmp eq i32 %cond2, 0, !dbg [[G2R2:!.*]]
16- ; CHECK-NEXT: br i1 %tobool12, label %bb.f2, label %exit, !dbg [[G2R1:!.*]]
16+ ; CHECK-NEXT: %tobool12 = icmp eq i32 %cond2, 0, !dbg [[G3R2:!.*]]
17+ ; CHECK-NEXT: br i1 %tobool12, label %bb.f2, label %exit, !dbg [[G3R1:!.*]]
18+
19+ ;; After the transform %ptr is null through bb.cond2 and @a through
20+ ;; bb.cond2.thread. Thread bb.cond2.thread->bb.f2 through bb.file.
21+ ;; Check the duplicated store gets a remapped atom group too.
22+
23+ ; CHECK: bb.file:
24+ ; CHECK-NEXT: %ptr3 = phi ptr [ null, %bb.cond2 ]
25+ ; CHECK-NEXT: store ptr %ptr3, ptr %p, align 4, !dbg [[G2R1:!.*]]
26+
27+ ; CHECK: bb.f2:
28+ ; CHECK-NEXT: store ptr @a, ptr %p, align 4, !dbg [[G4R1:!.*]]
1729
1830; CHECK: [[G1R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 2)
1931; CHECK: [[G1R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 1)
20- ; CHECK: [[G2R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 2)
21- ; CHECK: [[G2R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 1)
32+ ; CHECK: [[G3R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 3, atomRank: 2)
33+ ; CHECK: [[G3R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 3, atomRank: 1)
34+ ; CHECK: [[G2R1]] = !DILocation(line: 2, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 1)
35+ ; CHECK: [[G4R1]] = !DILocation(line: 2, column: 1, scope: ![[#]], atomGroup: 4, atomRank: 1)
2236
2337@a = global i32 0 , align 4
2438
25- define void @foo (i32 %cond1 , i32 %cond2 ) !dbg !5 {
39+ define void @foo (i32 %cond1 , i32 %cond2 , ptr %p ) !dbg !5 {
2640entry:
2741 %tobool = icmp eq i32 %cond1 , 0
2842 br i1 %tobool , label %bb.cond2 , label %bb.f1
@@ -37,6 +51,7 @@ bb.cond2: ; preds = %bb.f1, %entry
3751 br i1 %tobool1 , label %bb.file , label %exit , !dbg !10
3852
3953bb.file: ; preds = %bb.cond2
54+ store ptr %ptr , ptr %p , align 4 , !dbg !11
4055 %cmp = icmp eq ptr %ptr , null
4156 br i1 %cmp , label %exit , label %bb.f2
4257
@@ -66,3 +81,4 @@ declare void @f2()
6681!7 = !{}
6782!9 = !DILocation (line: 1 , column: 1 , scope: !5 , atomGroup: 1 , atomRank: 2 )
6883!10 = !DILocation (line: 1 , column: 1 , scope: !5 , atomGroup: 1 , atomRank: 1 )
84+ !11 = !DILocation (line: 2 , column: 1 , scope: !5 , atomGroup: 2 , atomRank: 1 )
0 commit comments