Skip to content

Commit f2b6b23

Browse files
committed
Add a new test before patch
1 parent b0b4a8e commit f2b6b23

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/Transforms/Util/PredicateInfo/testandor.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,3 +994,29 @@ define void @test_assume_deep_and_tree(i1 %a1) {
994994
call void @foo(i1 %a15)
995995
ret void
996996
}
997+
998+
define i32 @test_and_with_phinode(i32 %x) {
999+
; CHECK-LABEL: @test_and_with_phinode(
1000+
; CHECK-NEXT: entry:
1001+
; CHECK-NEXT: [[XGT0:%.*]] = icmp uge i32 [[X:%.*]], 1
1002+
; CHECK-NEXT: [[XLT1:%.*]] = icmp ult i32 [[X]], 2
1003+
; CHECK-NEXT: [[AND:%.*]] = and i1 [[XGT0]], [[XLT1]]
1004+
; CHECK: [[X_0_1:%.*]] = bitcast i32 [[X]] to i32
1005+
; CHECK-NEXT: br i1 [[AND]], label [[PHI:%.*]], label [[NOPE:%.*]]
1006+
; CHECK: nope:
1007+
; CHECK-NEXT: br label [[PHI]]
1008+
; CHECK: phi:
1009+
; CHECK-NEXT: [[RES:%.*]] = phi i32 [ [[X_0_1]], [[ENTRY:%.*]] ], [ 1, [[NOPE]] ]
1010+
; CHECK-NEXT: ret i32 [[RES]]
1011+
;
1012+
entry:
1013+
%xgt0 = icmp uge i32 %x, 1
1014+
%xlt1 = icmp ult i32 %x, 2
1015+
%and = and i1 %xgt0, %xlt1
1016+
br i1 %and, label %phi, label %nope
1017+
nope:
1018+
br label %phi
1019+
phi:
1020+
%res = phi i32 [ %x, %entry ], [ 1, %nope ]
1021+
ret i32 %res
1022+
}

0 commit comments

Comments
 (0)