1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -enable-new-pm=0 -attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=20 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=20 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4 ; RUN: opt -enable-new-pm=0 -attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
7 ; Test for multiple potential values
10 ; bool iszero(int c) { return c == 0; }
11 ; bool potential_test1(bool c) { return iszero(c ? 1 : -1); }
13 define internal i1 @iszero1(i32 %c) {
14 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
15 ; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero1
16 ; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] {
17 ; IS__CGSCC____-NEXT: ret i1 undef
19 %cmp = icmp eq i32 %c, 0
23 define i1 @potential_test1(i1 %c) {
24 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
25 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test1
26 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
27 ; IS__TUNIT____-NEXT: ret i1 false
29 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
30 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test1
31 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
32 ; IS__CGSCC____-NEXT: ret i1 false
34 %arg = select i1 %c, i32 -1, i32 1
35 %ret = call i1 @iszero1(i32 %arg)
42 ; potential values of argument of iszero are {1,-1}
43 ; potential value of returned value of iszero is 0
45 ; int call_with_two_values(int x) { return iszero(x) + iszero(-x); }
46 ; int potential_test2(int x) { return call_with_two_values(1) + call_with_two_values(-1); }
48 define internal i32 @iszero2(i32 %c) {
49 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
50 ; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero2
51 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
52 ; IS__CGSCC____-NEXT: ret i32 undef
54 %cmp = icmp eq i32 %c, 0
55 %ret = zext i1 %cmp to i32
59 define internal i32 @call_with_two_values(i32 %c) {
60 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
61 ; IS__CGSCC____-LABEL: define {{[^@]+}}@call_with_two_values
62 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
63 ; IS__CGSCC____-NEXT: ret i32 undef
65 %csret1 = call i32 @iszero2(i32 %c)
66 %minusc = sub i32 0, %c
67 %csret2 = call i32 @iszero2(i32 %minusc)
68 %ret = add i32 %csret1, %csret2
72 define i32 @potential_test2(i1 %c) {
73 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
74 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test2
75 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
76 ; IS__TUNIT____-NEXT: ret i32 0
78 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
79 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test2
80 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
81 ; IS__CGSCC____-NEXT: ret i32 0
83 %csret1 = call i32 @call_with_two_values(i32 1)
84 %csret2 = call i32 @call_with_two_values(i32 -1)
85 %ret = add i32 %csret1, %csret2
92 ; potential values of returned value of f are {0,1}
93 ; potential values of argument of g are {0,1}
94 ; potential value of returned value of g is 1
95 ; then returned value of g can be simplified
97 ; int zero_or_one(int c) { return c < 2; }
98 ; int potential_test3() { return zero_or_one(iszero(0))+zero_or_one(iszero(1)); }
100 define internal i32 @iszero3(i32 %c) {
101 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
102 ; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero3
103 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
104 ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 undef, 0
105 ; IS__CGSCC____-NEXT: [[RET:%.*]] = zext i1 undef to i32
106 ; IS__CGSCC____-NEXT: ret i32 undef
108 %cmp = icmp eq i32 %c, 0
109 %ret = zext i1 %cmp to i32
113 define internal i32 @less_than_two(i32 %c) {
114 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
115 ; IS__CGSCC____-LABEL: define {{[^@]+}}@less_than_two
116 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
117 ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp slt i32 undef, 2
118 ; IS__CGSCC____-NEXT: [[RET:%.*]] = zext i1 true to i32
119 ; IS__CGSCC____-NEXT: ret i32 undef
121 %cmp = icmp slt i32 %c, 2
122 %ret = zext i1 %cmp to i32
126 define i32 @potential_test3() {
127 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
128 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test3
129 ; IS__TUNIT____-SAME: () #[[ATTR0]] {
130 ; IS__TUNIT____-NEXT: ret i32 2
132 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
133 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test3
134 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
135 ; IS__CGSCC____-NEXT: ret i32 2
137 %cmp1 = call i32 @iszero3(i32 0)
138 %true1 = call i32 @less_than_two(i32 %cmp1)
139 %cmp2 = call i32 @iszero3(i32 1)
140 %true2 = call i32 @less_than_two(i32 %cmp2)
141 %ret = add i32 %true1, %true2
149 ; int potential_test4(int c) { return return1or3(c) == 2; }
150 ; int potential_test5(int c) { return return1or3(c) == return2or4(c); }
153 ; int potential_test6(int c) { return return1or3(c) == 3; }
154 ; int potential_test7(int c) { return return1or3(c) == return3or4(c); }
156 define i32 @potential_test4(i32 %c) {
157 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
158 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test4
159 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
160 ; IS__TUNIT____-NEXT: ret i32 0
162 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
163 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test4
164 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
165 ; IS__CGSCC____-NEXT: ret i32 0
167 %csret = call i32 @return1or3(i32 %c)
168 %false = icmp eq i32 %csret, 2
169 %ret = zext i1 %false to i32
173 define i32 @potential_test5(i32 %c) {
174 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
175 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test5
176 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
177 ; IS__TUNIT____-NEXT: ret i32 0
179 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
180 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test5
181 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
182 ; IS__CGSCC____-NEXT: ret i32 0
184 %csret1 = call i32 @return1or3(i32 %c)
185 %csret2 = call i32 @return2or4(i32 %c)
186 %false = icmp eq i32 %csret1, %csret2
187 %ret = zext i1 %false to i32
191 define i1 @potential_test6(i32 %c) {
192 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
193 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test6
194 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
195 ; IS__TUNIT____-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR0]], !range [[RNG0:![0-9]+]]
196 ; IS__TUNIT____-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3
197 ; IS__TUNIT____-NEXT: ret i1 [[RET]]
199 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
200 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test6
201 ; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
202 ; IS__CGSCC_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2:[0-9]+]], !range [[RNG0:![0-9]+]]
203 ; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3
204 ; IS__CGSCC_OPM-NEXT: ret i1 [[RET]]
206 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
207 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test6
208 ; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
209 ; IS__CGSCC_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]]
210 ; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3
211 ; IS__CGSCC_NPM-NEXT: ret i1 [[RET]]
213 %csret1 = call i32 @return1or3(i32 %c)
214 %ret = icmp eq i32 %csret1, 3
218 define i1 @potential_test7(i32 %c) {
219 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
220 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test7
221 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
222 ; IS__TUNIT____-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR0]], !range [[RNG0]]
223 ; IS__TUNIT____-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR0]], !range [[RNG1:![0-9]+]]
224 ; IS__TUNIT____-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]]
225 ; IS__TUNIT____-NEXT: ret i1 [[RET]]
227 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
228 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test7
229 ; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
230 ; IS__CGSCC_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]], !range [[RNG0]]
231 ; IS__CGSCC_OPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR2]], !range [[RNG1:![0-9]+]]
232 ; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]]
233 ; IS__CGSCC_OPM-NEXT: ret i1 [[RET]]
235 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
236 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test7
237 ; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
238 ; IS__CGSCC_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]], !range [[RNG0]]
239 ; IS__CGSCC_NPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR1]], !range [[RNG1:![0-9]+]]
240 ; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]]
241 ; IS__CGSCC_NPM-NEXT: ret i1 [[RET]]
243 %csret1 = call i32 @return1or3(i32 %c)
244 %csret2 = call i32 @return3or4(i32 %c)
245 %ret = icmp eq i32 %csret1, %csret2
249 define internal i32 @return1or3(i32 %c) {
250 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
251 ; IS__TUNIT____-LABEL: define {{[^@]+}}@return1or3
252 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
253 ; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0
254 ; IS__TUNIT____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 1, i32 3
255 ; IS__TUNIT____-NEXT: ret i32 [[RET]]
257 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
258 ; IS__CGSCC____-LABEL: define {{[^@]+}}@return1or3
259 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
260 ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0
261 ; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 1, i32 3
262 ; IS__CGSCC____-NEXT: ret i32 [[RET]]
264 %cmp = icmp eq i32 %c, 0
265 %ret = select i1 %cmp, i32 1, i32 3
269 define internal i32 @return2or4(i32 %c) {
270 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
271 ; IS__CGSCC____-LABEL: define {{[^@]+}}@return2or4
272 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
273 ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 undef, 0
274 ; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 undef, i32 2, i32 4
275 ; IS__CGSCC____-NEXT: ret i32 undef
277 %cmp = icmp eq i32 %c, 0
278 %ret = select i1 %cmp, i32 2, i32 4
282 define internal i32 @return3or4(i32 %c) {
283 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
284 ; IS__TUNIT____-LABEL: define {{[^@]+}}@return3or4
285 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
286 ; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0
287 ; IS__TUNIT____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 3, i32 4
288 ; IS__TUNIT____-NEXT: ret i32 [[RET]]
290 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
291 ; IS__CGSCC____-LABEL: define {{[^@]+}}@return3or4
292 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
293 ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0
294 ; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 3, i32 4
295 ; IS__CGSCC____-NEXT: ret i32 [[RET]]
297 %cmp = icmp eq i32 %c, 0
298 %ret = select i1 %cmp, i32 3, i32 4
304 ; propagate argument to callsite argument
306 define internal i1 @cmp_with_four(i32 %c) {
307 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
308 ; IS__CGSCC____-LABEL: define {{[^@]+}}@cmp_with_four
309 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
310 ; IS__CGSCC____-NEXT: ret i1 undef
312 %cmp = icmp eq i32 %c, 4
316 define internal i1 @wrapper(i32 %c) {
317 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
318 ; IS__CGSCC____-LABEL: define {{[^@]+}}@wrapper
319 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
320 ; IS__CGSCC____-NEXT: ret i1 undef
322 %ret = call i1 @cmp_with_four(i32 %c)
326 define i1 @potential_test8() {
327 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
328 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test8
329 ; IS__TUNIT____-SAME: () #[[ATTR0]] {
330 ; IS__TUNIT____-NEXT: ret i1 false
332 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
333 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test8
334 ; IS__CGSCC____-SAME: () #[[ATTR0]] {
335 ; IS__CGSCC____-NEXT: ret i1 false
337 %res1 = call i1 @wrapper(i32 1)
338 %res3 = call i1 @wrapper(i32 3)
339 %res5 = call i1 @wrapper(i32 5)
340 %res13 = or i1 %res1, %res3
341 %res135 = or i1 %res13, %res5
345 define i1 @potential_test9() {
346 ; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone
347 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test9
348 ; IS__TUNIT_OPM-SAME: () #[[ATTR1:[0-9]+]] {
349 ; IS__TUNIT_OPM-NEXT: entry:
350 ; IS__TUNIT_OPM-NEXT: br label [[COND:%.*]]
351 ; IS__TUNIT_OPM: cond:
352 ; IS__TUNIT_OPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ]
353 ; IS__TUNIT_OPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ]
354 ; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10
355 ; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]]
356 ; IS__TUNIT_OPM: body:
357 ; IS__TUNIT_OPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1
358 ; IS__TUNIT_OPM-NEXT: br label [[INC]]
359 ; IS__TUNIT_OPM: inc:
360 ; IS__TUNIT_OPM-NEXT: [[I_1]] = add i32 [[I_0]], 1
361 ; IS__TUNIT_OPM-NEXT: br label [[COND]]
362 ; IS__TUNIT_OPM: end:
363 ; IS__TUNIT_OPM-NEXT: ret i1 false
365 ; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
366 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test9
367 ; IS__TUNIT_NPM-SAME: () #[[ATTR0]] {
368 ; IS__TUNIT_NPM-NEXT: entry:
369 ; IS__TUNIT_NPM-NEXT: br label [[COND:%.*]]
370 ; IS__TUNIT_NPM: cond:
371 ; IS__TUNIT_NPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ]
372 ; IS__TUNIT_NPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ]
373 ; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10
374 ; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]]
375 ; IS__TUNIT_NPM: body:
376 ; IS__TUNIT_NPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1
377 ; IS__TUNIT_NPM-NEXT: br label [[INC]]
378 ; IS__TUNIT_NPM: inc:
379 ; IS__TUNIT_NPM-NEXT: [[I_1]] = add i32 [[I_0]], 1
380 ; IS__TUNIT_NPM-NEXT: br label [[COND]]
381 ; IS__TUNIT_NPM: end:
382 ; IS__TUNIT_NPM-NEXT: ret i1 false
384 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone
385 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test9
386 ; IS__CGSCC_OPM-SAME: () #[[ATTR1:[0-9]+]] {
387 ; IS__CGSCC_OPM-NEXT: entry:
388 ; IS__CGSCC_OPM-NEXT: br label [[COND:%.*]]
389 ; IS__CGSCC_OPM: cond:
390 ; IS__CGSCC_OPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ]
391 ; IS__CGSCC_OPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ]
392 ; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10
393 ; IS__CGSCC_OPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]]
394 ; IS__CGSCC_OPM: body:
395 ; IS__CGSCC_OPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1
396 ; IS__CGSCC_OPM-NEXT: br label [[INC]]
397 ; IS__CGSCC_OPM: inc:
398 ; IS__CGSCC_OPM-NEXT: [[I_1]] = add i32 [[I_0]], 1
399 ; IS__CGSCC_OPM-NEXT: br label [[COND]]
400 ; IS__CGSCC_OPM: end:
401 ; IS__CGSCC_OPM-NEXT: ret i1 false
403 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
404 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test9
405 ; IS__CGSCC_NPM-SAME: () #[[ATTR0]] {
406 ; IS__CGSCC_NPM-NEXT: entry:
407 ; IS__CGSCC_NPM-NEXT: br label [[COND:%.*]]
408 ; IS__CGSCC_NPM: cond:
409 ; IS__CGSCC_NPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ]
410 ; IS__CGSCC_NPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ]
411 ; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10
412 ; IS__CGSCC_NPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]]
413 ; IS__CGSCC_NPM: body:
414 ; IS__CGSCC_NPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1
415 ; IS__CGSCC_NPM-NEXT: br label [[INC]]
416 ; IS__CGSCC_NPM: inc:
417 ; IS__CGSCC_NPM-NEXT: [[I_1]] = add i32 [[I_0]], 1
418 ; IS__CGSCC_NPM-NEXT: br label [[COND]]
419 ; IS__CGSCC_NPM: end:
420 ; IS__CGSCC_NPM-NEXT: ret i1 false
425 %i.0 = phi i32 [0, %entry], [%i.1, %inc]
426 %c.0 = phi i32 [1, %entry], [%c.1, %inc]
427 %cmp = icmp slt i32 %i.0, 10
428 br i1 %cmp, label %body, label %end
430 %c.1 = mul i32 %c.0, -1
433 %i.1 = add i32 %i.0, 1
436 %ret = icmp eq i32 %c.0, 0
441 ; FIXME: potential returned values of @may_return_undef is {1, -1}
442 ; and returned value of @potential_test10 can be simplified to 0(false)
444 define internal i32 @may_return_undef(i32 %c) {
445 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
446 ; IS__CGSCC____-LABEL: define {{[^@]+}}@may_return_undef
447 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
448 ; IS__CGSCC____-NEXT: switch i32 [[C]], label [[OTHERWISE:%.*]] [
449 ; IS__CGSCC____-NEXT: i32 1, label [[A:%.*]]
450 ; IS__CGSCC____-NEXT: i32 -1, label [[B:%.*]]
451 ; IS__CGSCC____-NEXT: ]
453 ; IS__CGSCC____-NEXT: ret i32 undef
455 ; IS__CGSCC____-NEXT: ret i32 undef
456 ; IS__CGSCC____: otherwise:
457 ; IS__CGSCC____-NEXT: ret i32 undef
459 switch i32 %c, label %otherwise [i32 1, label %a
469 define i1 @potential_test10(i32 %c) {
470 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
471 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test10
472 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
473 ; IS__TUNIT____-NEXT: ret i1 false
475 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
476 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test10
477 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
478 ; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 undef, 0
479 ; IS__CGSCC____-NEXT: ret i1 false
481 %ret = call i32 @may_return_undef(i32 %c)
482 %cmp = icmp eq i32 %ret, 0
486 define i32 @optimize_undef_1(i1 %c) {
487 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
488 ; IS__TUNIT____-LABEL: define {{[^@]+}}@optimize_undef_1
489 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
490 ; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
492 ; IS__TUNIT____-NEXT: ret i32 0
494 ; IS__TUNIT____-NEXT: ret i32 1
496 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
497 ; IS__CGSCC____-LABEL: define {{[^@]+}}@optimize_undef_1
498 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
499 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
501 ; IS__CGSCC____-NEXT: ret i32 0
503 ; IS__CGSCC____-NEXT: ret i32 1
505 br i1 %c, label %t, label %f
509 %undef = add i32 undef, 1
513 define i32 @optimize_undef_2(i1 %c) {
514 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
515 ; IS__TUNIT____-LABEL: define {{[^@]+}}@optimize_undef_2
516 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
517 ; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
519 ; IS__TUNIT____-NEXT: ret i32 0
521 ; IS__TUNIT____-NEXT: ret i32 -1
523 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
524 ; IS__CGSCC____-LABEL: define {{[^@]+}}@optimize_undef_2
525 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
526 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
528 ; IS__CGSCC____-NEXT: ret i32 0
530 ; IS__CGSCC____-NEXT: ret i32 -1
532 br i1 %c, label %t, label %f
536 %undef = sub i32 undef, 1
540 define i32 @optimize_undef_3(i1 %c) {
541 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
542 ; IS__TUNIT____-LABEL: define {{[^@]+}}@optimize_undef_3
543 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
544 ; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
546 ; IS__TUNIT____-NEXT: ret i32 0
548 ; IS__TUNIT____-NEXT: ret i32 1
550 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
551 ; IS__CGSCC____-LABEL: define {{[^@]+}}@optimize_undef_3
552 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
553 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
555 ; IS__CGSCC____-NEXT: ret i32 0
557 ; IS__CGSCC____-NEXT: ret i32 1
559 br i1 %c, label %t, label %f
563 %undef = icmp eq i32 undef, 0
564 %undef2 = zext i1 %undef to i32
569 ; FIXME: returned value can be simplified to 0
570 define i32 @potential_test11(i1 %c) {
571 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
572 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test11
573 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
574 ; IS__TUNIT____-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR0]], !range [[RNG2:![0-9]+]]
575 ; IS__TUNIT____-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR0]], !range [[RNG3:![0-9]+]]
576 ; IS__TUNIT____-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR0]], !range [[RNG2]]
577 ; IS__TUNIT____-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]]
578 ; IS__TUNIT____-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]]
579 ; IS__TUNIT____-NEXT: ret i32 [[ACC2]]
581 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
582 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test11
583 ; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
584 ; IS__CGSCC_OPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR2]], !range [[RNG2:![0-9]+]]
585 ; IS__CGSCC_OPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR2]], !range [[RNG3:![0-9]+]]
586 ; IS__CGSCC_OPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR2]], !range [[RNG2]]
587 ; IS__CGSCC_OPM-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]]
588 ; IS__CGSCC_OPM-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]]
589 ; IS__CGSCC_OPM-NEXT: ret i32 [[ACC2]]
591 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
592 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test11
593 ; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
594 ; IS__CGSCC_NPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR1]], !range [[RNG2:![0-9]+]]
595 ; IS__CGSCC_NPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR1]], !range [[RNG3:![0-9]+]]
596 ; IS__CGSCC_NPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR1]], !range [[RNG2]]
597 ; IS__CGSCC_NPM-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]]
598 ; IS__CGSCC_NPM-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]]
599 ; IS__CGSCC_NPM-NEXT: ret i32 [[ACC2]]
601 %zero1 = call i32 @optimize_undef_1(i1 %c)
602 %zero2 = call i32 @optimize_undef_2(i1 %c)
603 %zero3 = call i32 @optimize_undef_3(i1 %c)
604 %acc1 = add i32 %zero1, %zero2
605 %acc2 = add i32 %acc1, %zero3
609 define i32 @optimize_poison_1(i1 %c) {
610 ; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
611 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@optimize_poison_1
612 ; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
613 ; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
615 ; IS__TUNIT_OPM-NEXT: ret i32 0
617 ; IS__TUNIT_OPM-NEXT: ret i32 -1
619 ; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
620 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@optimize_poison_1
621 ; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
622 ; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
624 ; IS__TUNIT_NPM-NEXT: ret i32 0
626 ; IS__TUNIT_NPM-NEXT: ret i32 undef
628 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
629 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@optimize_poison_1
630 ; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
631 ; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
633 ; IS__CGSCC_OPM-NEXT: ret i32 0
635 ; IS__CGSCC_OPM-NEXT: ret i32 -1
637 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
638 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@optimize_poison_1
639 ; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
640 ; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
642 ; IS__CGSCC_NPM-NEXT: ret i32 0
644 ; IS__CGSCC_NPM-NEXT: ret i32 undef
646 br i1 %c, label %t, label %f
650 %poison = sub nuw i32 0, 1
654 ; FIXME: returned value can be simplified to 0
655 define i32 @potential_test12(i1 %c) {
656 ; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
657 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test12
658 ; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
659 ; IS__TUNIT_OPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR0]], !range [[RNG3]]
660 ; IS__TUNIT_OPM-NEXT: ret i32 [[ZERO]]
662 ; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
663 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test12
664 ; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
665 ; IS__TUNIT_NPM-NEXT: ret i32 0
667 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
668 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test12
669 ; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
670 ; IS__CGSCC_OPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR2]], !range [[RNG3]]
671 ; IS__CGSCC_OPM-NEXT: ret i32 [[ZERO]]
673 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
674 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test12
675 ; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] {
676 ; IS__CGSCC_NPM-NEXT: ret i32 0
678 %zero = call i32 @optimize_poison_1(i1 %c)
683 ; Do not simplify %ret in the callee to `%c`.
684 ; The potential value of %c is {0, 1} (undef is merged).
685 ; However, we should not simplify `and i32 %c, 3` to `%c`
687 define internal i32 @potential_test13_callee(i32 %c) {
688 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
689 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_callee
690 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
691 ; IS__TUNIT____-NEXT: [[RET:%.*]] = and i32 [[C]], 3
692 ; IS__TUNIT____-NEXT: ret i32 [[RET]]
694 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
695 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test13_callee
696 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] {
697 ; IS__CGSCC____-NEXT: [[RET:%.*]] = and i32 [[C]], 3
698 ; IS__CGSCC____-NEXT: ret i32 [[RET]]
704 define i32 @potential_test13_caller1() {
705 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
706 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_caller1
707 ; IS__TUNIT____-SAME: () #[[ATTR0]] {
708 ; IS__TUNIT____-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR0]], !range [[RNG2]]
709 ; IS__TUNIT____-NEXT: ret i32 [[RET]]
711 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
712 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test13_caller1
713 ; IS__CGSCC_OPM-SAME: () #[[ATTR0]] {
714 ; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR2]], !range [[RNG2]]
715 ; IS__CGSCC_OPM-NEXT: ret i32 [[RET]]
717 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
718 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test13_caller1
719 ; IS__CGSCC_NPM-SAME: () #[[ATTR0]] {
720 ; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
721 ; IS__CGSCC_NPM-NEXT: ret i32 [[RET]]
723 %ret = call i32 @potential_test13_callee(i32 0)
727 define i32 @potential_test13_caller2() {
728 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
729 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_caller2
730 ; IS__TUNIT____-SAME: () #[[ATTR0]] {
731 ; IS__TUNIT____-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR0]], !range [[RNG2]]
732 ; IS__TUNIT____-NEXT: ret i32 [[RET]]
734 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
735 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test13_caller2
736 ; IS__CGSCC_OPM-SAME: () #[[ATTR0]] {
737 ; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR2]], !range [[RNG2]]
738 ; IS__CGSCC_OPM-NEXT: ret i32 [[RET]]
740 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
741 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test13_caller2
742 ; IS__CGSCC_NPM-SAME: () #[[ATTR0]] {
743 ; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR1]], !range [[RNG2]]
744 ; IS__CGSCC_NPM-NEXT: ret i32 [[RET]]
746 %ret = call i32 @potential_test13_callee(i32 1)
750 define i32 @potential_test13_caller3() {
751 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
752 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_caller3
753 ; IS__TUNIT____-SAME: () #[[ATTR0]] {
754 ; IS__TUNIT____-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR0]], !range [[RNG2]]
755 ; IS__TUNIT____-NEXT: ret i32 [[RET]]
757 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
758 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test13_caller3
759 ; IS__CGSCC_OPM-SAME: () #[[ATTR0]] {
760 ; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR2]], !range [[RNG2]]
761 ; IS__CGSCC_OPM-NEXT: ret i32 [[RET]]
763 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
764 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test13_caller3
765 ; IS__CGSCC_NPM-SAME: () #[[ATTR0]] {
766 ; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR1]], !range [[RNG2]]
767 ; IS__CGSCC_NPM-NEXT: ret i32 [[RET]]
769 %ret = call i32 @potential_test13_callee(i32 undef)
773 define i1 @potential_test14(i1 %c0, i1 %c1, i1 %c2, i1 %c3) {
774 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
775 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test14
776 ; IS__TUNIT____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR0]] {
777 ; IS__TUNIT____-NEXT: [[X0:%.*]] = select i1 [[C0]], i32 0, i32 1
778 ; IS__TUNIT____-NEXT: [[X1:%.*]] = select i1 [[C1]], i32 [[X0]], i32 undef
779 ; IS__TUNIT____-NEXT: [[Y2:%.*]] = select i1 [[C2]], i32 0, i32 7
780 ; IS__TUNIT____-NEXT: [[Z3:%.*]] = select i1 [[C3]], i32 [[X1]], i32 [[Y2]]
781 ; IS__TUNIT____-NEXT: [[RET:%.*]] = icmp slt i32 [[Z3]], 7
782 ; IS__TUNIT____-NEXT: ret i1 [[RET]]
784 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
785 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test14
786 ; IS__CGSCC____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR0]] {
787 ; IS__CGSCC____-NEXT: [[X0:%.*]] = select i1 [[C0]], i32 0, i32 1
788 ; IS__CGSCC____-NEXT: [[X1:%.*]] = select i1 [[C1]], i32 [[X0]], i32 undef
789 ; IS__CGSCC____-NEXT: [[Y2:%.*]] = select i1 [[C2]], i32 0, i32 7
790 ; IS__CGSCC____-NEXT: [[Z3:%.*]] = select i1 [[C3]], i32 [[X1]], i32 [[Y2]]
791 ; IS__CGSCC____-NEXT: [[RET:%.*]] = icmp slt i32 [[Z3]], 7
792 ; IS__CGSCC____-NEXT: ret i1 [[RET]]
794 %x0 = select i1 %c0, i32 0, i32 1
795 %x1 = select i1 %c1, i32 %x0, i32 undef
796 %y2 = select i1 %c2, i32 0, i32 7
797 %z3 = select i1 %c3, i32 %x1, i32 %y2
798 %ret = icmp slt i32 %z3, 7
802 define i1 @potential_test15(i1 %c0, i1 %c1) {
803 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
804 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test15
805 ; IS__TUNIT____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] {
806 ; IS__TUNIT____-NEXT: ret i1 false
808 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
809 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test15
810 ; IS__CGSCC____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] {
811 ; IS__CGSCC____-NEXT: ret i1 false
813 %x0 = select i1 %c0, i32 0, i32 1
814 %x1 = select i1 %c1, i32 %x0, i32 undef
815 %ret = icmp eq i32 %x1, 7
819 define i1 @potential_test16(i1 %c0, i1 %c1) {
820 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
821 ; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test16
822 ; IS__TUNIT____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] {
823 ; IS__TUNIT____-NEXT: ret i1 false
825 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
826 ; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test16
827 ; IS__CGSCC____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] {
828 ; IS__CGSCC____-NEXT: ret i1 false
830 %x0 = select i1 %c0, i32 0, i32 undef
831 %x1 = select i1 %c1, i32 %x0, i32 1
832 %ret = icmp eq i32 %x1, 7
837 ; IS__TUNIT_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
838 ; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone }
840 ; IS__TUNIT_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
842 ; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
843 ; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone }
844 ; IS__CGSCC_OPM: attributes #[[ATTR2]] = { readnone willreturn }
846 ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
847 ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { readnone willreturn }
849 ; CHECK: [[META0:![0-9]+]] = !{i32 1, i32 4}
850 ; CHECK: [[META1:![0-9]+]] = !{i32 3, i32 5}
851 ; CHECK: [[META2:![0-9]+]] = !{i32 0, i32 2}
852 ; CHECK: [[META3:![0-9]+]] = !{i32 -1, i32 1}