1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -correlated-propagation -S %s | FileCheck %s
3 ; RUN: opt -passes=correlated-propagation -S %s | FileCheck %s
5 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-apple-macosx10.10.0"
8 declare void @check1(i1) #1
9 declare void @check2(i1) #1
10 declare void @llvm.assume(i1)
12 ; Make sure we propagate the value of %tmp35 to the true/false cases
14 define void @test1(i64 %tmp35) {
15 ; CHECK-LABEL: @test1(
17 ; CHECK-NEXT: [[TMP36:%.*]] = icmp sgt i64 [[TMP35:%.*]], 0
18 ; CHECK-NEXT: br i1 [[TMP36]], label [[BB_TRUE:%.*]], label [[BB_FALSE:%.*]]
20 ; CHECK-NEXT: tail call void @check1(i1 false) #[[ATTR1:[0-9]+]]
21 ; CHECK-NEXT: unreachable
23 ; CHECK-NEXT: tail call void @check2(i1 true) #[[ATTR1]]
24 ; CHECK-NEXT: unreachable
27 %tmp36 = icmp sgt i64 %tmp35, 0
28 br i1 %tmp36, label %bb_true, label %bb_false
31 %tmp47 = icmp slt i64 %tmp35, 0
32 tail call void @check1(i1 %tmp47) #4
36 %tmp48 = icmp sle i64 %tmp35, 0
37 tail call void @check2(i1 %tmp48) #4
41 ; This is the same as test1 but with a diamond to ensure we
42 ; get %tmp36 from both true and false BBs.
44 define void @test2(i64 %tmp35, i1 %inner_cmp) {
45 ; CHECK-LABEL: @test2(
47 ; CHECK-NEXT: [[TMP36:%.*]] = icmp sgt i64 [[TMP35:%.*]], 0
48 ; CHECK-NEXT: br i1 [[TMP36]], label [[BB_TRUE:%.*]], label [[BB_FALSE:%.*]]
50 ; CHECK-NEXT: br i1 [[INNER_CMP:%.*]], label [[INNER_TRUE:%.*]], label [[INNER_FALSE:%.*]]
52 ; CHECK-NEXT: br label [[MERGE:%.*]]
54 ; CHECK-NEXT: br label [[MERGE]]
56 ; CHECK-NEXT: tail call void @check1(i1 false)
57 ; CHECK-NEXT: unreachable
59 ; CHECK-NEXT: tail call void @check2(i1 true) #[[ATTR1]]
60 ; CHECK-NEXT: unreachable
63 %tmp36 = icmp sgt i64 %tmp35, 0
64 br i1 %tmp36, label %bb_true, label %bb_false
67 br i1 %inner_cmp, label %inner_true, label %inner_false
76 %tmp47 = icmp slt i64 %tmp35, 0
77 tail call void @check1(i1 %tmp47) #0
81 %tmp48 = icmp sle i64 %tmp35, 0
82 tail call void @check2(i1 %tmp48) #4
86 ; Make sure binary operator transfer functions are run when RHS is non-constant
88 define i1 @test3(i32 %x, i32 %y) #0 {
89 ; CHECK-LABEL: @test3(
91 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 10
92 ; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
94 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y:%.*]], 10
95 ; CHECK-NEXT: br i1 [[CMP2]], label [[CONT2:%.*]], label [[OUT]]
97 ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[X]], [[Y]]
98 ; CHECK-NEXT: br label [[OUT]]
100 ; CHECK-NEXT: ret i1 true
103 %cmp1 = icmp ult i32 %x, 10
104 br i1 %cmp1, label %cont1, label %out
107 %cmp2 = icmp ult i32 %y, 10
108 br i1 %cmp2, label %cont2, label %out
111 %add = add i32 %x, %y
112 %cmp3 = icmp ult i32 %add, 25
116 %ret = phi i1 [ true, %entry], [ true, %cont1 ], [ %cmp3, %cont2 ]
120 ; Same as previous but make sure nobody gets over-zealous
122 define i1 @test4(i32 %x, i32 %y) #0 {
123 ; CHECK-LABEL: @test4(
125 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 10
126 ; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
128 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y:%.*]], 10
129 ; CHECK-NEXT: br i1 [[CMP2]], label [[CONT2:%.*]], label [[OUT]]
131 ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[X]], [[Y]]
132 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i32 [[ADD]], 15
133 ; CHECK-NEXT: br label [[OUT]]
135 ; CHECK-NEXT: [[RET:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ true, [[CONT1]] ], [ [[CMP3]], [[CONT2]] ]
136 ; CHECK-NEXT: ret i1 [[RET]]
139 %cmp1 = icmp ult i32 %x, 10
140 br i1 %cmp1, label %cont1, label %out
143 %cmp2 = icmp ult i32 %y, 10
144 br i1 %cmp2, label %cont2, label %out
147 %add = add i32 %x, %y
148 %cmp3 = icmp ult i32 %add, 15
152 %ret = phi i1 [ true, %entry], [ true, %cont1 ], [ %cmp3, %cont2 ]
156 ; Make sure binary operator transfer functions are run when RHS is non-constant
158 define i1 @test5(i32 %x, i32 %y) #0 {
159 ; CHECK-LABEL: @test5(
161 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 5
162 ; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
164 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y:%.*]], 5
165 ; CHECK-NEXT: br i1 [[CMP2]], label [[CONT2:%.*]], label [[OUT]]
167 ; CHECK-NEXT: [[SHIFTED:%.*]] = shl nuw nsw i32 [[X]], [[Y]]
168 ; CHECK-NEXT: br label [[OUT]]
170 ; CHECK-NEXT: ret i1 true
173 %cmp1 = icmp ult i32 %x, 5
174 br i1 %cmp1, label %cont1, label %out
177 %cmp2 = icmp ult i32 %y, 5
178 br i1 %cmp2, label %cont2, label %out
181 %shifted = shl i32 %x, %y
182 %cmp3 = icmp ult i32 %shifted, 65536
186 %ret = phi i1 [ true, %entry], [ true, %cont1 ], [ %cmp3, %cont2 ]
190 ; Same as previous but make sure nobody gets over-zealous
192 define i1 @test6(i32 %x, i32 %y) #0 {
193 ; CHECK-LABEL: @test6(
195 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i32 [[X:%.*]], 5
196 ; CHECK-NEXT: br i1 [[CMP1]], label [[CONT1:%.*]], label [[OUT:%.*]]
198 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[Y:%.*]], 15
199 ; CHECK-NEXT: br i1 [[CMP2]], label [[CONT2:%.*]], label [[OUT]]
201 ; CHECK-NEXT: [[SHIFTED:%.*]] = shl nuw nsw i32 [[X]], [[Y]]
202 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i32 [[SHIFTED]], 65536
203 ; CHECK-NEXT: br label [[OUT]]
205 ; CHECK-NEXT: [[RET:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ true, [[CONT1]] ], [ [[CMP3]], [[CONT2]] ]
206 ; CHECK-NEXT: ret i1 [[RET]]
209 %cmp1 = icmp ult i32 %x, 5
210 br i1 %cmp1, label %cont1, label %out
213 %cmp2 = icmp ult i32 %y, 15
214 br i1 %cmp2, label %cont2, label %out
217 %shifted = shl i32 %x, %y
218 %cmp3 = icmp ult i32 %shifted, 65536
222 %ret = phi i1 [ true, %entry], [ true, %cont1 ], [ %cmp3, %cont2 ]
226 define i1 @test7(i32 %a, i32 %b) {
227 ; CHECK-LABEL: @test7(
229 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
230 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
231 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
232 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
234 ; CHECK-NEXT: [[ADD:%.*]] = add nuw i32 [[A]], [[B]]
235 ; CHECK-NEXT: [[RES:%.*]] = icmp sge i32 [[ADD]], 0
236 ; CHECK-NEXT: br label [[EXIT]]
238 ; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[BB]] ]
239 ; CHECK-NEXT: ret i1 [[IV]]
242 %cmp0 = icmp sge i32 %a, 0
243 %cmp1 = icmp sge i32 %b, 0
244 %br = and i1 %cmp0, %cmp1
245 br i1 %br, label %bb, label %exit
248 %add = add i32 %a, %b
249 %res = icmp sge i32 %add, 0
253 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
257 define i1 @test8(i32 %a, i32 %b) {
258 ; CHECK-LABEL: @test8(
260 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
261 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
262 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
263 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
265 ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[A]], [[B]]
266 ; CHECK-NEXT: br label [[EXIT]]
268 ; CHECK-NEXT: ret i1 true
271 %cmp0 = icmp sge i32 %a, 0
272 %cmp1 = icmp sge i32 %b, 0
273 %br = and i1 %cmp0, %cmp1
274 br i1 %br, label %bb, label %exit
277 %add = add nsw i32 %a, %b
278 %res = icmp sge i32 %add, 0
282 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
286 define i1 @test10(i32 %a, i32 %b) {
287 ; CHECK-LABEL: @test10(
289 ; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[A:%.*]], -256
290 ; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
292 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[A]], [[B:%.*]]
293 ; CHECK-NEXT: [[RES:%.*]] = icmp uge i32 [[ADD]], -256
294 ; CHECK-NEXT: br label [[EXIT]]
296 ; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[BB]] ]
297 ; CHECK-NEXT: ret i1 [[IV]]
300 %cmp = icmp uge i32 %a, 4294967040
301 br i1 %cmp, label %bb, label %exit
304 %add = add i32 %a, %b
305 %res = icmp uge i32 %add, 4294967040
309 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
313 define i1 @test11(i32 %a, i32 %b) {
314 ; CHECK-LABEL: @test11(
316 ; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[A:%.*]], -256
317 ; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
319 ; CHECK-NEXT: [[ADD:%.*]] = add nuw i32 [[A]], [[B:%.*]]
320 ; CHECK-NEXT: br label [[EXIT]]
322 ; CHECK-NEXT: ret i1 true
325 %cmp = icmp uge i32 %a, 4294967040
326 br i1 %cmp, label %bb, label %exit
329 %add = add nuw i32 %a, %b
330 %res = icmp uge i32 %add, 4294967040
334 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
338 define i1 @test12(i32 %x) {
339 ; CHECK-LABEL: @test12(
340 ; CHECK-NEXT: [[ZEXT:%.*]] = zext i32 [[X:%.*]] to i64
341 ; CHECK-NEXT: [[MUL:%.*]] = mul nuw nsw i64 [[ZEXT]], 7
342 ; CHECK-NEXT: [[SHR:%.*]] = lshr i64 [[MUL]], 32
343 ; CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[SHR]] to i32
344 ; CHECK-NEXT: ret i1 true
346 %zext = zext i32 %x to i64
347 %mul = mul nuw i64 %zext, 7
348 %shr = lshr i64 %mul, 32
349 %trunc = trunc i64 %shr to i32
350 %cmp = icmp ult i32 %trunc, 7
354 define i1 @test13(i8 %x, i64* %p) {
355 ; CHECK-LABEL: @test13(
356 ; CHECK-NEXT: [[ZEXT:%.*]] = zext i8 [[X:%.*]] to i64
357 ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[ZEXT]], 128
358 ; CHECK-NEXT: store i64 [[ADD]], i64* [[P:%.*]], align 8
359 ; CHECK-NEXT: ret i1 true
361 %zext = zext i8 %x to i64
362 %add = add nuw nsw i64 %zext, 128
363 %cmp = icmp ult i64 %add, 384
364 ; Without this extra use, InstSimplify could handle this
365 store i64 %add, i64* %p
369 define i1 @test14(i32 %a, i32 %b) {
370 ; CHECK-LABEL: @test14(
372 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
373 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
374 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
375 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
377 ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[A]], [[B]]
378 ; CHECK-NEXT: [[RES:%.*]] = icmp sge i32 [[SUB]], 0
379 ; CHECK-NEXT: br label [[EXIT]]
381 ; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[BB]] ]
382 ; CHECK-NEXT: ret i1 [[IV]]
385 %cmp0 = icmp sge i32 %a, 0
386 %cmp1 = icmp sge i32 %b, 0
387 %br = and i1 %cmp0, %cmp1
388 br i1 %br, label %bb, label %exit
391 %sub = sub i32 %a, %b
392 %res = icmp sge i32 %sub, 0
396 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
400 define i1 @test15(i32 %a, i32 %b) {
401 ; CHECK-LABEL: @test15(
403 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
404 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
405 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
406 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
408 ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[A]], [[B]]
409 ; CHECK-NEXT: [[RES:%.*]] = icmp sge i32 [[SUB]], 0
410 ; CHECK-NEXT: br label [[EXIT]]
412 ; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[BB]] ]
413 ; CHECK-NEXT: ret i1 [[IV]]
416 %cmp0 = icmp sge i32 %a, 0
417 %cmp1 = icmp sge i32 %b, 0
418 %br = and i1 %cmp0, %cmp1
419 br i1 %br, label %bb, label %exit
422 %sub = sub nsw i32 %a, %b
423 %res = icmp sge i32 %sub, 0
427 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
431 define i1 @test16(i32 %a, i32 %b) {
432 ; CHECK-LABEL: @test16(
434 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sge i32 [[A:%.*]], 0
435 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
436 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
437 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
439 ; CHECK-NEXT: [[SUB:%.*]] = sub nuw nsw i32 [[A]], [[B]]
440 ; CHECK-NEXT: br label [[EXIT]]
442 ; CHECK-NEXT: ret i1 true
445 %cmp0 = icmp sge i32 %a, 0
446 %cmp1 = icmp sge i32 %b, 0
447 %br = and i1 %cmp0, %cmp1
448 br i1 %br, label %bb, label %exit
451 %sub = sub nuw i32 %a, %b
452 %res = icmp sge i32 %sub, 0
456 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
460 define i1 @test17(i32 %a, i32 %b) {
461 ; CHECK-LABEL: @test17(
463 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sle i32 [[A:%.*]], 0
464 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
465 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
466 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
468 ; CHECK-NEXT: [[SUB:%.*]] = sub i32 [[A]], [[B]]
469 ; CHECK-NEXT: [[RES:%.*]] = icmp sle i32 [[SUB]], 0
470 ; CHECK-NEXT: br label [[EXIT]]
472 ; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[BB]] ]
473 ; CHECK-NEXT: ret i1 [[IV]]
476 %cmp0 = icmp sle i32 %a, 0
477 %cmp1 = icmp sge i32 %b, 0
478 %br = and i1 %cmp0, %cmp1
479 br i1 %br, label %bb, label %exit
482 %sub = sub i32 %a, %b
483 %res = icmp sle i32 %sub, 0
487 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
491 define i1 @test18(i32 %a, i32 %b) {
492 ; CHECK-LABEL: @test18(
494 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sle i32 [[A:%.*]], 0
495 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
496 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
497 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
499 ; CHECK-NEXT: [[SUB:%.*]] = sub nuw i32 [[A]], [[B]]
500 ; CHECK-NEXT: [[RES:%.*]] = icmp sle i32 [[SUB]], 0
501 ; CHECK-NEXT: br label [[EXIT]]
503 ; CHECK-NEXT: [[IV:%.*]] = phi i1 [ true, [[BEGIN:%.*]] ], [ [[RES]], [[BB]] ]
504 ; CHECK-NEXT: ret i1 [[IV]]
507 %cmp0 = icmp sle i32 %a, 0
508 %cmp1 = icmp sge i32 %b, 0
509 %br = and i1 %cmp0, %cmp1
510 br i1 %br, label %bb, label %exit
513 %sub = sub nuw i32 %a, %b
514 %res = icmp sle i32 %sub, 0
518 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
522 define i1 @test19(i32 %a, i32 %b) {
523 ; CHECK-LABEL: @test19(
525 ; CHECK-NEXT: [[CMP0:%.*]] = icmp sle i32 [[A:%.*]], 0
526 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i32 [[B:%.*]], 0
527 ; CHECK-NEXT: [[BR:%.*]] = and i1 [[CMP0]], [[CMP1]]
528 ; CHECK-NEXT: br i1 [[BR]], label [[BB:%.*]], label [[EXIT:%.*]]
530 ; CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[A]], [[B]]
531 ; CHECK-NEXT: br label [[EXIT]]
533 ; CHECK-NEXT: ret i1 true
536 %cmp0 = icmp sle i32 %a, 0
537 %cmp1 = icmp sge i32 %b, 0
538 %br = and i1 %cmp0, %cmp1
539 br i1 %br, label %bb, label %exit
542 %sub = sub nsw i32 %a, %b
543 %res = icmp sle i32 %sub, 0
547 %iv = phi i1 [ true, %begin ], [ %res, %bb ]
551 define i1 @test_br_cmp_with_offset(i64 %idx) {
552 ; CHECK-LABEL: @test_br_cmp_with_offset(
553 ; CHECK-NEXT: [[IDX_OFF1:%.*]] = add i64 [[IDX:%.*]], -5
554 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[IDX_OFF1]], 3
555 ; CHECK-NEXT: br i1 [[CMP1]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
557 ; CHECK-NEXT: [[IDX_OFF2:%.*]] = add nsw i64 [[IDX]], -1
558 ; CHECK-NEXT: ret i1 true
560 ; CHECK-NEXT: ret i1 undef
562 %idx.off1 = add i64 %idx, -5
563 %cmp1 = icmp ult i64 %idx.off1, 3
564 br i1 %cmp1, label %if.true, label %if.false
567 %idx.off2 = add i64 %idx, -1
568 %cmp2 = icmp ult i64 %idx.off2, 10
575 define i1 @test_assume_cmp_with_offset(i64 %idx) {
576 ; CHECK-LABEL: @test_assume_cmp_with_offset(
577 ; CHECK-NEXT: [[IDX_OFF1:%.*]] = add i64 [[IDX:%.*]], -5
578 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[IDX_OFF1]], 3
579 ; CHECK-NEXT: tail call void @llvm.assume(i1 [[CMP1]])
580 ; CHECK-NEXT: [[IDX_OFF2:%.*]] = add nsw i64 [[IDX]], -1
581 ; CHECK-NEXT: ret i1 true
583 %idx.off1 = add i64 %idx, -5
584 %cmp1 = icmp ult i64 %idx.off1, 3
585 tail call void @llvm.assume(i1 %cmp1)
586 %idx.off2 = add i64 %idx, -1
587 %cmp2 = icmp ult i64 %idx.off2, 10
591 define void @test_cmp_phi(i8 %a) {
592 ; CHECK-LABEL: @test_cmp_phi(
594 ; CHECK-NEXT: [[C0:%.*]] = icmp ult i8 [[A:%.*]], 2
595 ; CHECK-NEXT: br i1 [[C0]], label [[LOOP:%.*]], label [[EXIT:%.*]]
597 ; CHECK-NEXT: [[P:%.*]] = phi i8 [ [[A]], [[ENTRY:%.*]] ], [ [[B:%.*]], [[LOOP]] ]
598 ; CHECK-NEXT: [[C1:%.*]] = icmp ne i8 [[P]], 0
599 ; CHECK-NEXT: [[C4:%.*]] = call i1 @get_bool()
600 ; CHECK-NEXT: [[B]] = zext i1 [[C4]] to i8
601 ; CHECK-NEXT: br i1 [[C1]], label [[LOOP]], label [[EXIT]]
603 ; CHECK-NEXT: ret void
606 %c0 = icmp ult i8 %a, 2
607 br i1 %c0, label %loop, label %exit
610 %p = phi i8 [ %a, %entry ], [ %b, %loop ]
611 %c1 = icmp ne i8 %p, 0
612 %c2 = icmp ne i8 %p, 2
613 %c3 = and i1 %c1, %c2
614 %c4 = call i1 @get_bool()
615 %b = zext i1 %c4 to i8
616 br i1 %c3, label %loop, label %exit
622 declare i1 @get_bool()
624 define void @test_icmp_or_ult(i32 %a, i32 %b) {
625 ; CHECK-LABEL: @test_icmp_or_ult(
627 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]]
628 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[OR]], 42
629 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
631 ; CHECK-NEXT: call void @check1(i1 true)
632 ; CHECK-NEXT: call void @check1(i1 true)
633 ; CHECK-NEXT: ret void
635 ; CHECK-NEXT: [[CMP4:%.*]] = icmp uge i32 [[A]], 42
636 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
637 ; CHECK-NEXT: [[CMP5:%.*]] = icmp uge i32 [[B]], 42
638 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
639 ; CHECK-NEXT: ret void
643 %cmp = icmp ult i32 %or, 42
644 br i1 %cmp, label %if.true, label %if.false
647 %cmp2 = icmp ult i32 %a, 42
648 call void @check1(i1 %cmp2)
649 %cmp3 = icmp ult i32 %b, 42
650 call void @check1(i1 %cmp3)
654 %cmp4 = icmp uge i32 %a, 42
655 call void @check1(i1 %cmp4)
656 %cmp5 = icmp uge i32 %b, 42
657 call void @check1(i1 %cmp5)
661 define void @test_icmp_or_ule(i32 %a, i32 %b) {
662 ; CHECK-LABEL: @test_icmp_or_ule(
664 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]]
665 ; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[OR]], 42
666 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
668 ; CHECK-NEXT: call void @check1(i1 true)
669 ; CHECK-NEXT: call void @check1(i1 true)
670 ; CHECK-NEXT: ret void
672 ; CHECK-NEXT: [[CMP4:%.*]] = icmp ugt i32 [[A]], 42
673 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
674 ; CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[B]], 42
675 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
676 ; CHECK-NEXT: ret void
680 %cmp = icmp ule i32 %or, 42
681 br i1 %cmp, label %if.true, label %if.false
684 %cmp2 = icmp ule i32 %a, 42
685 call void @check1(i1 %cmp2)
686 %cmp3 = icmp ule i32 %b, 42
687 call void @check1(i1 %cmp3)
691 %cmp4 = icmp ugt i32 %a, 42
692 call void @check1(i1 %cmp4)
693 %cmp5 = icmp ugt i32 %b, 42
694 call void @check1(i1 %cmp5)
698 define void @test_icmp_or_ugt(i32 %a, i32 %b) {
699 ; CHECK-LABEL: @test_icmp_or_ugt(
701 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]]
702 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[OR]], 42
703 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
705 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i32 [[A]], 42
706 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
707 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ugt i32 [[B]], 42
708 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
709 ; CHECK-NEXT: ret void
711 ; CHECK-NEXT: call void @check1(i1 true)
712 ; CHECK-NEXT: call void @check1(i1 true)
713 ; CHECK-NEXT: ret void
717 %cmp = icmp ugt i32 %or, 42
718 br i1 %cmp, label %if.true, label %if.false
721 %cmp2 = icmp ugt i32 %a, 42
722 call void @check1(i1 %cmp2)
723 %cmp3 = icmp ugt i32 %b, 42
724 call void @check1(i1 %cmp3)
728 %cmp4 = icmp ule i32 %a, 42
729 call void @check1(i1 %cmp4)
730 %cmp5 = icmp ule i32 %b, 42
731 call void @check1(i1 %cmp5)
735 define void @test_icmp_or_uge(i32 %a, i32 %b) {
736 ; CHECK-LABEL: @test_icmp_or_uge(
738 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]]
739 ; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[OR]], 42
740 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
742 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 42
743 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
744 ; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[B]], 42
745 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
746 ; CHECK-NEXT: ret void
748 ; CHECK-NEXT: call void @check1(i1 true)
749 ; CHECK-NEXT: call void @check1(i1 true)
750 ; CHECK-NEXT: ret void
754 %cmp = icmp uge i32 %or, 42
755 br i1 %cmp, label %if.true, label %if.false
758 %cmp2 = icmp uge i32 %a, 42
759 call void @check1(i1 %cmp2)
760 %cmp3 = icmp uge i32 %b, 42
761 call void @check1(i1 %cmp3)
765 %cmp4 = icmp ult i32 %a, 42
766 call void @check1(i1 %cmp4)
767 %cmp5 = icmp ult i32 %b, 42
768 call void @check1(i1 %cmp5)
772 define void @test_icmp_or_slt(i32 %a, i32 %b) {
773 ; CHECK-LABEL: @test_icmp_or_slt(
775 ; CHECK-NEXT: [[OR:%.*]] = or i32 [[A:%.*]], [[B:%.*]]
776 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[OR]], 42
777 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
779 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[A]], 42
780 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
781 ; CHECK-NEXT: [[CMP3:%.*]] = icmp slt i32 [[B]], 42
782 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
783 ; CHECK-NEXT: ret void
785 ; CHECK-NEXT: [[CMP4:%.*]] = icmp sge i32 [[A]], 42
786 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
787 ; CHECK-NEXT: [[CMP5:%.*]] = icmp sge i32 [[B]], 42
788 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
789 ; CHECK-NEXT: ret void
793 %cmp = icmp slt i32 %or, 42
794 br i1 %cmp, label %if.true, label %if.false
797 %cmp2 = icmp slt i32 %a, 42
798 call void @check1(i1 %cmp2)
799 %cmp3 = icmp slt i32 %b, 42
800 call void @check1(i1 %cmp3)
804 %cmp4 = icmp sge i32 %a, 42
805 call void @check1(i1 %cmp4)
806 %cmp5 = icmp sge i32 %b, 42
807 call void @check1(i1 %cmp5)
811 define void @test_icmp_and_ugt(i32 %a, i32 %b) {
812 ; CHECK-LABEL: @test_icmp_and_ugt(
814 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]]
815 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[AND]], 42
816 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
818 ; CHECK-NEXT: call void @check1(i1 true)
819 ; CHECK-NEXT: call void @check1(i1 true)
820 ; CHECK-NEXT: ret void
822 ; CHECK-NEXT: [[CMP4:%.*]] = icmp ule i32 [[A]], 42
823 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
824 ; CHECK-NEXT: [[CMP5:%.*]] = icmp ule i32 [[B]], 42
825 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
826 ; CHECK-NEXT: ret void
829 %and = and i32 %a, %b
830 %cmp = icmp ugt i32 %and, 42
831 br i1 %cmp, label %if.true, label %if.false
834 %cmp2 = icmp ugt i32 %a, 42
835 call void @check1(i1 %cmp2)
836 %cmp3 = icmp ugt i32 %b, 42
837 call void @check1(i1 %cmp3)
841 %cmp4 = icmp ule i32 %a, 42
842 call void @check1(i1 %cmp4)
843 %cmp5 = icmp ule i32 %b, 42
844 call void @check1(i1 %cmp5)
848 define void @test_icmp_and_uge(i32 %a, i32 %b) {
849 ; CHECK-LABEL: @test_icmp_and_uge(
851 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]]
852 ; CHECK-NEXT: [[CMP:%.*]] = icmp uge i32 [[AND]], 42
853 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
855 ; CHECK-NEXT: call void @check1(i1 true)
856 ; CHECK-NEXT: call void @check1(i1 true)
857 ; CHECK-NEXT: ret void
859 ; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], 42
860 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
861 ; CHECK-NEXT: [[CMP5:%.*]] = icmp ult i32 [[B]], 42
862 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
863 ; CHECK-NEXT: ret void
866 %and = and i32 %a, %b
867 %cmp = icmp uge i32 %and, 42
868 br i1 %cmp, label %if.true, label %if.false
871 %cmp2 = icmp uge i32 %a, 42
872 call void @check1(i1 %cmp2)
873 %cmp3 = icmp uge i32 %b, 42
874 call void @check1(i1 %cmp3)
878 %cmp4 = icmp ult i32 %a, 42
879 call void @check1(i1 %cmp4)
880 %cmp5 = icmp ult i32 %b, 42
881 call void @check1(i1 %cmp5)
885 define void @test_icmp_and_ult(i32 %a, i32 %b) {
886 ; CHECK-LABEL: @test_icmp_and_ult(
888 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]]
889 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[AND]], 42
890 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
892 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[A]], 42
893 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
894 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ult i32 [[B]], 42
895 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
896 ; CHECK-NEXT: ret void
898 ; CHECK-NEXT: call void @check1(i1 true)
899 ; CHECK-NEXT: call void @check1(i1 true)
900 ; CHECK-NEXT: ret void
903 %and = and i32 %a, %b
904 %cmp = icmp ult i32 %and, 42
905 br i1 %cmp, label %if.true, label %if.false
908 %cmp2 = icmp ult i32 %a, 42
909 call void @check1(i1 %cmp2)
910 %cmp3 = icmp ult i32 %b, 42
911 call void @check1(i1 %cmp3)
915 %cmp4 = icmp uge i32 %a, 42
916 call void @check1(i1 %cmp4)
917 %cmp5 = icmp uge i32 %b, 42
918 call void @check1(i1 %cmp5)
922 define void @test_icmp_and_sgt(i32 %a, i32 %b) {
923 ; CHECK-LABEL: @test_icmp_and_sgt(
925 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], [[B:%.*]]
926 ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[AND]], 42
927 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
929 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[A]], 42
930 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
931 ; CHECK-NEXT: [[CMP3:%.*]] = icmp sgt i32 [[B]], 42
932 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
933 ; CHECK-NEXT: ret void
935 ; CHECK-NEXT: [[CMP4:%.*]] = icmp sle i32 [[A]], 42
936 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
937 ; CHECK-NEXT: [[CMP5:%.*]] = icmp sle i32 [[B]], 42
938 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
939 ; CHECK-NEXT: ret void
942 %and = and i32 %a, %b
943 %cmp = icmp sgt i32 %and, 42
944 br i1 %cmp, label %if.true, label %if.false
947 %cmp2 = icmp sgt i32 %a, 42
948 call void @check1(i1 %cmp2)
949 %cmp3 = icmp sgt i32 %b, 42
950 call void @check1(i1 %cmp3)
954 %cmp4 = icmp sle i32 %a, 42
955 call void @check1(i1 %cmp4)
956 %cmp5 = icmp sle i32 %b, 42
957 call void @check1(i1 %cmp5)
961 define void @test_icmp_mask_eq_two_values(i32 %a) {
962 ; CHECK-LABEL: @test_icmp_mask_eq_two_values(
963 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], -2
964 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 10
965 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
967 ; CHECK-NEXT: call void @check1(i1 true)
968 ; CHECK-NEXT: call void @check1(i1 true)
969 ; CHECK-NEXT: call void @check1(i1 false)
970 ; CHECK-NEXT: call void @check1(i1 false)
971 ; CHECK-NEXT: ret void
973 ; CHECK-NEXT: ret void
975 %and = and i32 %a, -2
976 %cmp = icmp eq i32 %and, 10
977 br i1 %cmp, label %if.true, label %if.false
980 %cmp2 = icmp uge i32 %a, 10
981 call void @check1(i1 %cmp2)
982 %cmp3 = icmp ule i32 %a, 11
983 call void @check1(i1 %cmp3)
984 %cmp4 = icmp ult i32 %a, 10
985 call void @check1(i1 %cmp4)
986 %cmp5 = icmp ugt i32 %a, 11
987 call void @check1(i1 %cmp5)
994 define void @test_icmp_mask_eq_bit_set(i32 %a) {
995 ; CHECK-LABEL: @test_icmp_mask_eq_bit_set(
996 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 32
997 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 32
998 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1000 ; CHECK-NEXT: call void @check1(i1 true)
1001 ; CHECK-NEXT: [[CMP3:%.*]] = icmp uge i32 [[A]], 33
1002 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
1003 ; CHECK-NEXT: ret void
1005 ; CHECK-NEXT: ret void
1007 %and = and i32 %a, 32
1008 %cmp = icmp eq i32 %and, 32
1009 br i1 %cmp, label %if.true, label %if.false
1012 %cmp2 = icmp uge i32 %a, 32
1013 call void @check1(i1 %cmp2)
1014 %cmp3 = icmp uge i32 %a, 33
1015 call void @check1(i1 %cmp3)
1022 define void @test_icmp_mask_eq_bit_unset(i32 %a) {
1023 ; CHECK-LABEL: @test_icmp_mask_eq_bit_unset(
1024 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 32
1025 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0
1026 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1028 ; CHECK-NEXT: call void @check1(i1 true)
1029 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[A]], -34
1030 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
1031 ; CHECK-NEXT: ret void
1033 ; CHECK-NEXT: ret void
1035 %and = and i32 %a, 32
1036 %cmp = icmp eq i32 %and, 0
1037 br i1 %cmp, label %if.true, label %if.false
1040 %cmp2 = icmp ule i32 %a, -33
1041 call void @check1(i1 %cmp2)
1042 %cmp3 = icmp ule i32 %a, -34
1043 call void @check1(i1 %cmp3)
1050 define void @test_icmp_mask_eq_wrong_predicate(i32 %a) {
1051 ; CHECK-LABEL: @test_icmp_mask_eq_wrong_predicate(
1052 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], -2
1053 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[AND]], 10
1054 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1056 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 10
1057 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
1058 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ule i32 [[A]], 11
1059 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
1060 ; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], 10
1061 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
1062 ; CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[A]], 11
1063 ; CHECK-NEXT: call void @check1(i1 [[CMP5]])
1064 ; CHECK-NEXT: ret void
1066 ; CHECK-NEXT: ret void
1068 %and = and i32 %a, -2
1069 %cmp = icmp ne i32 %and, 10
1070 br i1 %cmp, label %if.true, label %if.false
1073 %cmp2 = icmp uge i32 %a, 10
1074 call void @check1(i1 %cmp2)
1075 %cmp3 = icmp ule i32 %a, 11
1076 call void @check1(i1 %cmp3)
1077 %cmp4 = icmp ult i32 %a, 10
1078 call void @check1(i1 %cmp4)
1079 %cmp5 = icmp ugt i32 %a, 11
1080 call void @check1(i1 %cmp5)
1087 define void @test_icmp_mask_ne(i32 %a) {
1088 ; CHECK-LABEL: @test_icmp_mask_ne(
1089 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 6
1090 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[AND]], 0
1091 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1093 ; CHECK-NEXT: call void @check1(i1 true)
1094 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ugt i32 [[A]], 2
1095 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
1096 ; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], -1
1097 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
1098 ; CHECK-NEXT: ret void
1100 ; CHECK-NEXT: ret void
1102 %and = and i32 %a, 6
1103 %cmp = icmp ne i32 %and, 0
1104 br i1 %cmp, label %if.true, label %if.false
1107 %cmp2 = icmp uge i32 %a, 2
1108 call void @check1(i1 %cmp2)
1109 %cmp3 = icmp ugt i32 %a, 2
1110 call void @check1(i1 %cmp3)
1111 %cmp4 = icmp ult i32 %a, -1
1112 call void @check1(i1 %cmp4)
1119 define void @test_icmp_mask_ne_nonzero_cmp(i32 %a) {
1120 ; CHECK-LABEL: @test_icmp_mask_ne_nonzero_cmp(
1121 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 6
1122 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[AND]], 6
1123 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1125 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i32 [[A]], 2
1126 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
1127 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ugt i32 [[A]], 2
1128 ; CHECK-NEXT: call void @check1(i1 [[CMP3]])
1129 ; CHECK-NEXT: [[CMP4:%.*]] = icmp ult i32 [[A]], -1
1130 ; CHECK-NEXT: call void @check1(i1 [[CMP4]])
1131 ; CHECK-NEXT: ret void
1133 ; CHECK-NEXT: ret void
1135 %and = and i32 %a, 6
1136 %cmp = icmp ne i32 %and, 6
1137 br i1 %cmp, label %if.true, label %if.false
1140 %cmp2 = icmp uge i32 %a, 2
1141 call void @check1(i1 %cmp2)
1142 %cmp3 = icmp ugt i32 %a, 2
1143 call void @check1(i1 %cmp3)
1144 %cmp4 = icmp ult i32 %a, -1
1145 call void @check1(i1 %cmp4)
1152 define void @test_icmp_mask_ne_zero_mask(i32 %a) {
1153 ; CHECK-LABEL: @test_icmp_mask_ne_zero_mask(
1154 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A:%.*]], 0
1155 ; CHECK-NEXT: br i1 false, label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1157 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[A]], 0
1158 ; CHECK-NEXT: call void @check1(i1 [[CMP2]])
1159 ; CHECK-NEXT: ret void
1161 ; CHECK-NEXT: ret void
1163 %and = and i32 %a, 0
1164 %cmp = icmp ne i32 %and, 0
1165 br i1 %cmp, label %if.true, label %if.false
1168 %cmp2 = icmp ne i32 %a, 0
1169 call void @check1(i1 %cmp2)
1176 attributes #4 = { noreturn }