• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -print-predicateinfo < %s 2>&1 | FileCheck %s
3define i1 @f(i32 %x, i1 %y) {
4; CHECK-LABEL: @f(
5; CHECK-NEXT:    br i1 [[Y:%.*]], label [[BB0:%.*]], label [[BB1:%.*]]
6; CHECK:       bb0:
7; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[X:%.*]], 0
8; CHECK:         [[X_0:%.*]] = call i32 @llvm.ssa.copy.{{.+}}(i32 [[X]])
9; CHECK-NEXT:    br i1 [[CMP]], label [[BB2:%.*]], label [[BB3:%.*]]
10; CHECK:       bb1:
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 [[X2]])
14; CHECK-NEXT:    br i1 [[CMP2]], label [[BB2]], label [[BB3]]
15; CHECK:       bb2:
16; CHECK-NEXT:    [[X3:%.*]] = phi i32 [ [[X_0]], [[BB0]] ], [ [[X2_0]], [[BB1]] ]
17; CHECK-NEXT:    br label [[BB3]]
18; CHECK:       bb3:
19; CHECK-NEXT:    ret i1 false
20;
21  br i1 %y, label %bb0, label %bb1
22  bb0:
23  %cmp = icmp sge i32 %x, 0  ; x > 0
24  br i1 %cmp, label %bb2, label %bb3
25  bb1:
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
29  bb2:
30  %x3 = phi i32 [ %x, %bb0 ], [ %x2, %bb1 ]
31  br label %bb3
32  bb3:
33  ret i1 0
34}
35
36define i1 @g(i32 %x, i1 %y) {
37; CHECK-LABEL: @g(
38; CHECK-NEXT:    br i1 [[Y:%.*]], label [[BB0:%.*]], label [[BB1:%.*]]
39; CHECK:       bb0:
40; CHECK-NEXT:    [[CMP:%.*]] = icmp sge i32 [[X:%.*]], 0
41; CHECK:         [[X_0:%.*]] = call i32 @llvm.ssa.copy.{{.+}}(i32 [[X]])
42; CHECK-NEXT:    br i1 [[CMP]], label [[BB3:%.*]], label [[BB2:%.*]]
43; CHECK:       bb1:
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 [[X2]])
47; CHECK-NEXT:    br i1 [[CMP2]], label [[BB3]], label [[BB2]]
48; CHECK:       bb2:
49; CHECK-NEXT:    [[X3:%.*]] = phi i32 [ [[X_0]], [[BB0]] ], [ [[X2_0]], [[BB1]] ]
50; CHECK-NEXT:    br label [[BB3]]
51; CHECK:       bb3:
52; CHECK-NEXT:    ret i1 false
53;
54  br i1 %y, label %bb0, label %bb1
55  bb0:
56  %cmp = icmp sge i32 %x, 0  ; x > 0
57  br i1 %cmp, label %bb3, label %bb2
58  bb1:
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
62  bb2:
63  %x3 = phi i32 [ %x, %bb0 ], [ %x2, %bb1 ]
64  br label %bb3
65  bb3:
66  ret i1 0
67}
68
69