1 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
3 ; x = [10, 21), y = [100, 201)
5 define internal i1 @f.add(i32 %x, i32 %y) {
6 ; CHECK-LABEL: define internal i1 @f.add(i32 %x, i32 %y) {
7 ; CHECK-NEXT: %a.1 = add i32 %x, %y
8 ; CHECK-NEXT: %c.2 = icmp sgt i32 %a.1, 219
9 ; CHECK-NEXT: %c.4 = icmp slt i32 %a.1, 111
10 ; CHECK-NEXT: %c.5 = icmp eq i32 %a.1, 150
11 ; CHECK-NEXT: %c.6 = icmp slt i32 %a.1, 150
12 ; CHECK-NEXT: %res.1 = add i1 false, %c.2
13 ; CHECK-NEXT: %res.2 = add i1 %res.1, false
14 ; CHECK-NEXT: %res.3 = add i1 %res.2, %c.4
15 ; CHECK-NEXT: %res.4 = add i1 %res.3, %c.5
16 ; CHECK-NEXT: %res.5 = add i1 %res.4, %c.6
17 ; CHECK-NEXT: ret i1 %res.5
20 %c.1 = icmp sgt i32 %a.1, 220
21 %c.2 = icmp sgt i32 %a.1, 219
22 %c.3 = icmp slt i32 %a.1, 110
23 %c.4 = icmp slt i32 %a.1, 111
24 %c.5 = icmp eq i32 %a.1, 150
25 %c.6 = icmp slt i32 %a.1, 150
26 %res.1 = add i1 %c.1, %c.2
27 %res.2 = add i1 %res.1, %c.3
28 %res.3 = add i1 %res.2, %c.4
29 %res.4 = add i1 %res.3, %c.5
30 %res.5 = add i1 %res.4, %c.6
34 define i1 @caller.add() {
35 ; CHECK-LABEL: define i1 @caller.add() {
36 ; CHECK-NEXT: %call.1 = tail call i1 @f.add(i32 10, i32 100)
37 ; CHECK-NEXT: %call.2 = tail call i1 @f.add(i32 20, i32 200)
38 ; CHECK-NEXT: %res = and i1 %call.1, %call.2
39 ; CHECK-NEXT: ret i1 %res
41 %call.1 = tail call i1 @f.add(i32 10, i32 100)
42 %call.2 = tail call i1 @f.add(i32 20, i32 200)
43 %res = and i1 %call.1, %call.2
48 ; x = [10, 21), y = [100, 201)
50 define internal i1 @f.sub(i32 %x, i32 %y) {
51 ; CHECK-LABEL: define internal i1 @f.sub(i32 %x, i32 %y) {
52 ; CHECK-NEXT: %a.1 = sub i32 %x, %y
53 ; CHECK-NEXT: %c.2 = icmp sgt i32 %a.1, -81
54 ; CHECK-NEXT: %c.4 = icmp slt i32 %a.1, -189
55 ; CHECK-NEXT: %c.5 = icmp eq i32 %a.1, -150
56 ; CHECK-NEXT: %c.6 = icmp slt i32 %a.1, -150
57 ; CHECK-NEXT: %res.1 = add i1 false, %c.2
58 ; CHECK-NEXT: %res.2 = add i1 %res.1, false
59 ; CHECK-NEXT: %res.3 = add i1 %res.2, %c.4
60 ; CHECK-NEXT: %res.4 = add i1 %res.3, %c.5
61 ; CHECK-NEXT: %res.5 = add i1 %res.4, %c.6
62 ; CHECK-NEXT: ret i1 %res.5
65 %c.1 = icmp sgt i32 %a.1, -80
66 %c.2 = icmp sgt i32 %a.1, -81
67 %c.3 = icmp slt i32 %a.1, -190
68 %c.4 = icmp slt i32 %a.1, -189
69 %c.5 = icmp eq i32 %a.1, -150
70 %c.6 = icmp slt i32 %a.1, -150
71 %res.1 = add i1 %c.1, %c.2
72 %res.2 = add i1 %res.1, %c.3
73 %res.3 = add i1 %res.2, %c.4
74 %res.4 = add i1 %res.3, %c.5
75 %res.5 = add i1 %res.4, %c.6
79 define i1 @caller.sub() {
80 ; CHECK-LABEL: define i1 @caller.sub() {
81 ; CHECK-NEXT: %call.1 = tail call i1 @f.sub(i32 10, i32 100)
82 ; CHECK-NEXT: %call.2 = tail call i1 @f.sub(i32 20, i32 200)
83 ; CHECK-NEXT: %res = and i1 %call.1, %call.2
84 ; CHECK-NEXT: ret i1 %res
86 %call.1 = tail call i1 @f.sub(i32 10, i32 100)
87 %call.2 = tail call i1 @f.sub(i32 20, i32 200)
88 %res = and i1 %call.1, %call.2
92 ; x = [10, 21), y = [100, 201)
93 ; x * y = [1000, 4001)
94 define internal i1 @f.mul(i32 %x, i32 %y) {
95 ; CHECK-LABEL: define internal i1 @f.mul(i32 %x, i32 %y) {
96 ; CHECK-NEXT: %a.1 = mul i32 %x, %y
97 ; CHECK-NEXT: %c.2 = icmp sgt i32 %a.1, 3999
98 ; CHECK-NEXT: %c.4 = icmp slt i32 %a.1, 1001
99 ; CHECK-NEXT: %c.5 = icmp eq i32 %a.1, 1500
100 ; CHECK-NEXT: %c.6 = icmp slt i32 %a.1, 1500
101 ; CHECK-NEXT: %res.1 = add i1 false, %c.2
102 ; CHECK-NEXT: %res.2 = add i1 %res.1, false
103 ; CHECK-NEXT: %res.3 = add i1 %res.2, %c.4
104 ; CHECK-NEXT: %res.4 = add i1 %res.3, %c.5
105 ; CHECK-NEXT: %res.5 = add i1 %res.4, %c.6
106 ; CHECK-NEXT: ret i1 %res.5
108 %a.1 = mul i32 %x, %y
109 %c.1 = icmp sgt i32 %a.1, 4000
110 %c.2 = icmp sgt i32 %a.1, 3999
111 %c.3 = icmp slt i32 %a.1, 1000
112 %c.4 = icmp slt i32 %a.1, 1001
113 %c.5 = icmp eq i32 %a.1, 1500
114 %c.6 = icmp slt i32 %a.1, 1500
115 %res.1 = add i1 %c.1, %c.2
116 %res.2 = add i1 %res.1, %c.3
117 %res.3 = add i1 %res.2, %c.4
118 %res.4 = add i1 %res.3, %c.5
119 %res.5 = add i1 %res.4, %c.6
123 define i1 @caller.mul() {
124 ; CHECK-LABEL: define i1 @caller.mul() {
125 ; CHECK-NEXT: %call.1 = tail call i1 @f.mul(i32 10, i32 100)
126 ; CHECK-NEXT: %call.2 = tail call i1 @f.mul(i32 20, i32 200)
127 ; CHECK-NEXT: %res = and i1 %call.1, %call.2
128 ; CHECK-NEXT: ret i1 %res
130 %call.1 = tail call i1 @f.mul(i32 10, i32 100)
131 %call.2 = tail call i1 @f.mul(i32 20, i32 200)
132 %res = and i1 %call.1, %call.2