1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
6 define void @test_1_variable_constraint(i8 %x, i8 %y, i8 %z) {
7 ; CHECK-LABEL: @test_1_variable_constraint(
9 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
10 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]]
12 ; CHECK-NEXT: call void @use(i1 true)
13 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 10
14 ; CHECK-NEXT: call void @use(i1 [[C_2]])
15 ; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[Y]], [[X]]
16 ; CHECK-NEXT: call void @use(i1 [[C_3]])
17 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 10, [[X]]
18 ; CHECK-NEXT: call void @use(i1 [[C_4]])
19 ; CHECK-NEXT: ret void
21 ; CHECK-NEXT: call void @use(i1 true)
22 ; CHECK-NEXT: call void @use(i1 false)
23 ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 10
24 ; CHECK-NEXT: call void @use(i1 [[C_5]])
25 ; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 10, [[X]]
26 ; CHECK-NEXT: call void @use(i1 [[C_6]])
27 ; CHECK-NEXT: ret void
30 %c.1 = icmp uge i8 %x, %y
31 br i1 %c.1, label %bb1, label %bb2
34 %t.1 = icmp uge i8 %x, %y
35 call void @use(i1 %t.1)
36 %c.2 = icmp uge i8 %x, 10
37 call void @use(i1 %c.2)
38 %c.3 = icmp uge i8 %y, %x
39 call void @use(i1 %c.3)
40 %c.4 = icmp uge i8 10, %x
41 call void @use(i1 %c.4)
45 %t.2 = icmp uge i8 %y, %x
46 call void @use(i1 %t.2)
47 %f.1 = icmp uge i8 %x, %y
48 call void @use(i1 %f.1)
49 %c.5 = icmp uge i8 %x, 10
50 call void @use(i1 %c.5)
51 %c.6 = icmp uge i8 10, %x
52 call void @use(i1 %c.6)
56 define void @test_1_constant_constraint(i8 %x) {
57 ; CHECK-LABEL: @test_1_constant_constraint(
59 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10
60 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]]
62 ; CHECK-NEXT: call void @use(i1 true)
63 ; CHECK-NEXT: call void @use(i1 true)
64 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 11
65 ; CHECK-NEXT: call void @use(i1 [[C_2]])
66 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 10, [[X]]
67 ; CHECK-NEXT: call void @use(i1 [[C_4]])
68 ; CHECK-NEXT: ret void
70 ; CHECK-NEXT: call void @use(i1 true)
71 ; CHECK-NEXT: call void @use(i1 false)
72 ; CHECK-NEXT: call void @use(i1 false)
73 ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 9
74 ; CHECK-NEXT: call void @use(i1 [[C_5]])
75 ; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 1, [[X]]
76 ; CHECK-NEXT: call void @use(i1 [[C_6]])
77 ; CHECK-NEXT: ret void
80 %c.1 = icmp uge i8 %x, 10
81 br i1 %c.1, label %bb1, label %bb2
84 %t.1 = icmp uge i8 %x, 10
85 call void @use(i1 %t.1)
86 %t.2 = icmp uge i8 %x, 9
87 call void @use(i1 %t.2)
88 %c.2 = icmp uge i8 %x, 11
89 call void @use(i1 %c.2)
90 %c.4 = icmp uge i8 10, %x
91 call void @use(i1 %c.4)
95 %t.3 = icmp uge i8 11, %x
96 call void @use(i1 %t.3)
97 %f.1 = icmp uge i8 %x, 10
98 call void @use(i1 %f.1)
101 %f.1.1 = icmp uge i8 %x, 10
102 call void @use(i1 %f.1.1)
103 %c.5 = icmp uge i8 %x, 9
104 call void @use(i1 %c.5)
105 %c.6 = icmp uge i8 1, %x
106 call void @use(i1 %c.6)
110 define i8 @test1(i8 %x, i8 %y, i8 %z) {
111 ; CHECK-LABEL: @test1(
113 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
114 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
116 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]]
117 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
119 ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]]
121 ; CHECK-NEXT: ret i8 10
123 ; CHECK-NEXT: ret i8 20
126 %c.1 = icmp uge i8 %x, %y
127 br i1 %c.1, label %bb1, label %exit
130 %c.2 = icmp uge i8 %y, %z
131 br i1 %c.2, label %bb2, label %exit
134 %c.3 = icmp uge i8 %x, %z
135 br i1 %c.3, label %bb3, label %exit
145 define i8 @test2(i8 %x, i8 %y, i8 %z, i8 %a) {
146 ; CHECK-LABEL: @test2(
148 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
149 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
151 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]]
152 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
154 ; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[X]], [[A:%.*]]
155 ; CHECK-NEXT: br i1 [[C_3]], label [[BB3:%.*]], label [[EXIT]]
157 ; CHECK-NEXT: ret i8 10
159 ; CHECK-NEXT: ret i8 20
162 %c.1 = icmp uge i8 %x, %y
163 br i1 %c.1, label %bb1, label %exit
166 %c.2 = icmp uge i8 %y, %z
167 br i1 %c.2, label %bb2, label %exit
170 %c.3 = icmp uge i8 %x, %a
171 br i1 %c.3, label %bb3, label %exit
181 define i8 @test3(i8 %x, i8 %y) {
182 ; CHECK-LABEL: @test3(
184 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10
185 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
187 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y:%.*]], 20
188 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
190 ; CHECK-NEXT: ret i8 10
192 ; CHECK-NEXT: ret i8 20
195 %c.1 = icmp uge i8 %x, 10
196 br i1 %c.1, label %bb1, label %exit
199 %c.2 = icmp uge i8 %y, 20
200 br i1 %c.2, label %bb2, label %exit
209 define i8 @test4(i8 %x, i8 %y, i8 %z) {
210 ; CHECK-LABEL: @test4(
212 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
213 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
215 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]]
216 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
218 ; CHECK-NEXT: call void @use(i1 true)
219 ; CHECK-NEXT: [[U_1:%.*]] = icmp eq i8 [[X]], [[Z]]
220 ; CHECK-NEXT: call void @use(i1 [[U_1]])
221 ; CHECK-NEXT: ret i8 10
223 ; CHECK-NEXT: ret i8 20
226 %c.1 = icmp uge i8 %x, %y
227 br i1 %c.1, label %bb1, label %exit
230 %c.2 = icmp uge i8 %y, %z
231 br i1 %c.2, label %bb2, label %exit
234 %t.1 = icmp uge i8 %x, %z
235 call void @use(i1 %t.1)
236 %u.1 = icmp eq i8 %x, %z
237 call void @use(i1 %u.1)