Skip to content

Commit 6929307

Browse files
committed
Make testing more robust
1 parent e1a8bfb commit 6929307

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

llvm/test/Analysis/ValueTracking/phi-self.ll

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
; Test `%r` can be replaced by `%nonpoison`.
55

6-
define i32 @other_noundef() {
7-
; CHECK-LABEL: define i32 @other_noundef() {
6+
define i32 @other_noundef(i32 noundef %arg) {
7+
; CHECK-LABEL: define i32 @other_noundef(
8+
; CHECK-SAME: i32 noundef [[ARG:%.*]]) {
89
; CHECK-NEXT: [[START:.*]]:
910
; CHECK-NEXT: br label %[[LOOP:.*]]
1011
; CHECK: [[LOOP]]:
11-
; CHECK-NEXT: [[NONPOISON:%.*]] = phi i32 [ 0, %[[START]] ], [ [[NONPOISON]], %[[BB0:.*]] ], [ 1, %[[BB1:.*]] ]
12+
; CHECK-NEXT: [[NONPOISON:%.*]] = phi i32 [ 0, %[[START]] ], [ [[NONPOISON]], %[[BB0:.*]] ], [ [[ARG]], %[[BB1:.*]] ]
1213
; CHECK-NEXT: [[I:%.*]] = call i32 @opaque()
1314
; CHECK-NEXT: switch i32 [[I]], label %[[EXIT:.*]] [
1415
; CHECK-NEXT: i32 0, label %[[BB0]]
@@ -25,7 +26,7 @@ start:
2526
br label %loop
2627

2728
loop:
28-
%nonpoison = phi i32 [ 0, %start ], [ %nonpoison, %bb0 ], [ 1, %bb1 ]
29+
%nonpoison = phi i32 [ 0, %start ], [ %nonpoison, %bb0 ], [ %arg, %bb1 ]
2930
%i = call i32 @opaque()
3031
switch i32 %i, label %exit [
3132
i32 0, label %bb0
@@ -43,18 +44,21 @@ bb1:
4344
br label %loop
4445
}
4546

46-
define i32 @other_poison() {
47-
; CHECK-LABEL: define i32 @other_poison() {
48-
; CHECK-NEXT: [[START:.*:]]
47+
define i32 @other_poison(i32 %arg) {
48+
; CHECK-LABEL: define i32 @other_poison(
49+
; CHECK-SAME: i32 [[ARG:%.*]]) {
50+
; CHECK-NEXT: [[START:.*]]:
4951
; CHECK-NEXT: br label %[[LOOP:.*]]
5052
; CHECK: [[LOOP]]:
53+
; CHECK-NEXT: [[MAYPOISON:%.*]] = phi i32 [ 0, %[[START]] ], [ [[MAYPOISON]], %[[BB0:.*]] ], [ [[ARG]], %[[BB1:.*]] ]
5154
; CHECK-NEXT: [[I:%.*]] = call i32 @opaque()
5255
; CHECK-NEXT: switch i32 [[I]], label %[[EXIT:.*]] [
53-
; CHECK-NEXT: i32 0, label %[[BB0:.*]]
54-
; CHECK-NEXT: i32 1, label %[[BB1:.*]]
56+
; CHECK-NEXT: i32 0, label %[[BB0]]
57+
; CHECK-NEXT: i32 1, label %[[BB1]]
5558
; CHECK-NEXT: ]
5659
; CHECK: [[EXIT]]:
57-
; CHECK-NEXT: ret i32 0
60+
; CHECK-NEXT: [[R:%.*]] = freeze i32 [[MAYPOISON]]
61+
; CHECK-NEXT: ret i32 [[R]]
5862
; CHECK: [[BB0]]:
5963
; CHECK-NEXT: br label %[[LOOP]]
6064
; CHECK: [[BB1]]:
@@ -64,7 +68,7 @@ start:
6468
br label %loop
6569

6670
loop:
67-
%maypoison = phi i32 [ 0, %start ], [ %maypoison, %bb0 ], [ poison, %bb1 ]
71+
%maypoison = phi i32 [ 0, %start ], [ %maypoison, %bb0 ], [ %arg, %bb1 ]
6872
%i = call i32 @opaque()
6973
switch i32 %i, label %exit [
7074
i32 0, label %bb0

0 commit comments

Comments
 (0)