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