1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=print-predicateinfo < %s 2>&1 | FileCheck %s
3 define i1 @f(i32 %x, i1 %y) {
5 ; CHECK-NEXT: br i1 [[Y:%.*]], label [[BB0:%.*]], label [[BB1:%.*]]
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[X:%.*]], 0
8 ; CHECK: [[X_0:%.*]] = call i32 @llvm.ssa.copy.i32(i32 [[X]])
9 ; CHECK-NEXT: br i1 [[CMP]], label [[BB2:%.*]], label [[BB3:%.*]]
11 ; CHECK-NEXT: [[X2:%.*]] = add nuw nsw i32 [[X]], 1
12 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i32 [[X2]], 2
13 ; CHECK: [[X2_0:%.*]] = call i32 @llvm.ssa.copy.i32(i32 [[X2]])
14 ; CHECK-NEXT: br i1 [[CMP2]], label [[BB2]], label [[BB3]]
16 ; CHECK-NEXT: [[X3:%.*]] = phi i32 [ [[X_0]], [[BB0]] ], [ [[X2_0]], [[BB1]] ]
17 ; CHECK-NEXT: br label [[BB3]]
19 ; CHECK-NEXT: ret i1 false
21 br i1 %y, label %bb0, label %bb1
23 %cmp = icmp sge i32 %x, 0 ; x > 0
24 br i1 %cmp, label %bb2, label %bb3
26 %x2 = add nsw nuw i32 %x, 1
27 %cmp2 = icmp sge i32 %x2, 2 ; x+1 > 2 / x > 1
28 br i1 %cmp2, label %bb2, label %bb3
30 %x3 = phi i32 [ %x, %bb0 ], [ %x2, %bb1 ]
36 define i1 @g(i32 %x, i1 %y) {
38 ; CHECK-NEXT: br i1 [[Y:%.*]], label [[BB0:%.*]], label [[BB1:%.*]]
40 ; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[X:%.*]], 0
41 ; CHECK: [[X_0:%.*]] = call i32 @llvm.ssa.copy.i32(i32 [[X]])
42 ; CHECK-NEXT: br i1 [[CMP]], label [[BB3:%.*]], label [[BB2:%.*]]
44 ; CHECK-NEXT: [[X2:%.*]] = add nuw nsw i32 [[X]], 1
45 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i32 [[X2]], 2
46 ; CHECK: [[X2_0:%.*]] = call i32 @llvm.ssa.copy.i32(i32 [[X2]])
47 ; CHECK-NEXT: br i1 [[CMP2]], label [[BB3]], label [[BB2]]
49 ; CHECK-NEXT: [[X3:%.*]] = phi i32 [ [[X_0]], [[BB0]] ], [ [[X2_0]], [[BB1]] ]
50 ; CHECK-NEXT: br label [[BB3]]
52 ; CHECK-NEXT: ret i1 false
54 br i1 %y, label %bb0, label %bb1
56 %cmp = icmp sge i32 %x, 0 ; x > 0
57 br i1 %cmp, label %bb3, label %bb2
59 %x2 = add nsw nuw i32 %x, 1
60 %cmp2 = icmp sge i32 %x2, 2 ; x+1 > 2 / x > 1
61 br i1 %cmp2, label %bb3, label %bb2
63 %x3 = phi i32 [ %x, %bb0 ], [ %x2, %bb1 ]