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: [[T_1:%.*]] = icmp uge i8 [[X]], [[Y]]
13 ; CHECK-NEXT: call void @use(i1 true)
14 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 10
15 ; CHECK-NEXT: call void @use(i1 [[C_2]])
16 ; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[Y]], [[X]]
17 ; CHECK-NEXT: call void @use(i1 [[C_3]])
18 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 10, [[X]]
19 ; CHECK-NEXT: call void @use(i1 [[C_4]])
20 ; CHECK-NEXT: ret void
22 ; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[Y]], [[X]]
23 ; CHECK-NEXT: call void @use(i1 true)
24 ; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[X]], [[Y]]
25 ; CHECK-NEXT: call void @use(i1 false)
26 ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 10
27 ; CHECK-NEXT: call void @use(i1 [[C_5]])
28 ; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 10, [[X]]
29 ; CHECK-NEXT: call void @use(i1 [[C_6]])
30 ; CHECK-NEXT: ret void
33 %c.1 = icmp uge i8 %x, %y
34 br i1 %c.1, label %bb1, label %bb2
37 %t.1 = icmp uge i8 %x, %y
38 call void @use(i1 %t.1)
39 %c.2 = icmp uge i8 %x, 10
40 call void @use(i1 %c.2)
41 %c.3 = icmp uge i8 %y, %x
42 call void @use(i1 %c.3)
43 %c.4 = icmp uge i8 10, %x
44 call void @use(i1 %c.4)
48 %t.2 = icmp uge i8 %y, %x
49 call void @use(i1 %t.2)
50 %f.1 = icmp uge i8 %x, %y
51 call void @use(i1 %f.1)
52 %c.5 = icmp uge i8 %x, 10
53 call void @use(i1 %c.5)
54 %c.6 = icmp uge i8 10, %x
55 call void @use(i1 %c.6)
59 define void @test_1_constant_constraint(i8 %x) {
60 ; CHECK-LABEL: @test_1_constant_constraint(
62 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10
63 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[BB2:%.*]]
65 ; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], 10
66 ; CHECK-NEXT: call void @use(i1 true)
67 ; CHECK-NEXT: [[T_2:%.*]] = icmp uge i8 [[X]], 9
68 ; CHECK-NEXT: call void @use(i1 true)
69 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[X]], 11
70 ; CHECK-NEXT: call void @use(i1 [[C_2]])
71 ; CHECK-NEXT: [[C_4:%.*]] = icmp uge i8 10, [[X]]
72 ; CHECK-NEXT: call void @use(i1 [[C_4]])
73 ; CHECK-NEXT: ret void
75 ; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 11, [[X]]
76 ; CHECK-NEXT: call void @use(i1 true)
77 ; CHECK-NEXT: [[F_1:%.*]] = icmp uge i8 [[X]], 10
78 ; CHECK-NEXT: call void @use(i1 false)
79 ; CHECK-NEXT: [[F_1_1:%.*]] = icmp uge i8 [[X]], 10
80 ; CHECK-NEXT: call void @use(i1 false)
81 ; CHECK-NEXT: [[C_5:%.*]] = icmp uge i8 [[X]], 9
82 ; CHECK-NEXT: call void @use(i1 [[C_5]])
83 ; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 1, [[X]]
84 ; CHECK-NEXT: call void @use(i1 [[C_6]])
85 ; CHECK-NEXT: ret void
88 %c.1 = icmp uge i8 %x, 10
89 br i1 %c.1, label %bb1, label %bb2
92 %t.1 = icmp uge i8 %x, 10
93 call void @use(i1 %t.1)
94 %t.2 = icmp uge i8 %x, 9
95 call void @use(i1 %t.2)
96 %c.2 = icmp uge i8 %x, 11
97 call void @use(i1 %c.2)
98 %c.4 = icmp uge i8 10, %x
99 call void @use(i1 %c.4)
103 %t.3 = icmp uge i8 11, %x
104 call void @use(i1 %t.3)
105 %f.1 = icmp uge i8 %x, 10
106 call void @use(i1 %f.1)
109 %f.1.1 = icmp uge i8 %x, 10
110 call void @use(i1 %f.1.1)
111 %c.5 = icmp uge i8 %x, 9
112 call void @use(i1 %c.5)
113 %c.6 = icmp uge i8 1, %x
114 call void @use(i1 %c.6)
118 define i8 @test1(i8 %x, i8 %y, i8 %z) {
119 ; CHECK-LABEL: @test1(
121 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
122 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
124 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]]
125 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
127 ; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[X]], [[Z]]
128 ; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[EXIT]]
130 ; CHECK-NEXT: ret i8 10
132 ; CHECK-NEXT: ret i8 20
135 %c.1 = icmp uge i8 %x, %y
136 br i1 %c.1, label %bb1, label %exit
139 %c.2 = icmp uge i8 %y, %z
140 br i1 %c.2, label %bb2, label %exit
143 %c.3 = icmp uge i8 %x, %z
144 br i1 %c.3, label %bb3, label %exit
154 define i8 @test2(i8 %x, i8 %y, i8 %z, i8 %a) {
155 ; CHECK-LABEL: @test2(
157 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
158 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
160 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]]
161 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
163 ; CHECK-NEXT: [[C_3:%.*]] = icmp uge i8 [[X]], [[A:%.*]]
164 ; CHECK-NEXT: br i1 [[C_3]], label [[BB3:%.*]], label [[EXIT]]
166 ; CHECK-NEXT: ret i8 10
168 ; CHECK-NEXT: ret i8 20
171 %c.1 = icmp uge i8 %x, %y
172 br i1 %c.1, label %bb1, label %exit
175 %c.2 = icmp uge i8 %y, %z
176 br i1 %c.2, label %bb2, label %exit
179 %c.3 = icmp uge i8 %x, %a
180 br i1 %c.3, label %bb3, label %exit
190 define i8 @test3(i8 %x, i8 %y) {
191 ; CHECK-LABEL: @test3(
193 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], 10
194 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
196 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y:%.*]], 20
197 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
199 ; CHECK-NEXT: ret i8 10
201 ; CHECK-NEXT: ret i8 20
204 %c.1 = icmp uge i8 %x, 10
205 br i1 %c.1, label %bb1, label %exit
208 %c.2 = icmp uge i8 %y, 20
209 br i1 %c.2, label %bb2, label %exit
218 define i8 @test4(i8 %x, i8 %y, i8 %z) {
219 ; CHECK-LABEL: @test4(
221 ; CHECK-NEXT: [[C_1:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
222 ; CHECK-NEXT: br i1 [[C_1]], label [[BB1:%.*]], label [[EXIT:%.*]]
224 ; CHECK-NEXT: [[C_2:%.*]] = icmp uge i8 [[Y]], [[Z:%.*]]
225 ; CHECK-NEXT: br i1 [[C_2]], label [[BB2:%.*]], label [[EXIT]]
227 ; CHECK-NEXT: [[T_1:%.*]] = icmp uge i8 [[X]], [[Z]]
228 ; CHECK-NEXT: call void @use(i1 true)
229 ; CHECK-NEXT: [[U_1:%.*]] = icmp eq i8 [[X]], [[Z]]
230 ; CHECK-NEXT: call void @use(i1 [[U_1]])
231 ; CHECK-NEXT: ret i8 10
233 ; CHECK-NEXT: ret i8 20
236 %c.1 = icmp uge i8 %x, %y
237 br i1 %c.1, label %bb1, label %exit
240 %c.2 = icmp uge i8 %y, %z
241 br i1 %c.2, label %bb2, label %exit
244 %t.1 = icmp uge i8 %x, %z
245 call void @use(i1 %t.1)
246 %u.1 = icmp eq i8 %x, %z
247 call void @use(i1 %u.1)