1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
5 declare void @sideeffect()
7 define i32 @add_const_incoming0_speculative(i1 %b, i32 %x, i32 %y) {
8 ; CHECK-LABEL: @add_const_incoming0_speculative(
10 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
12 ; CHECK-NEXT: br label [[THEN]]
14 ; CHECK-NEXT: [[P0:%.*]] = phi i32 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
15 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ 17, [[IF]] ], [ [[Y:%.*]], [[ENTRY]] ]
16 ; CHECK-NEXT: [[R:%.*]] = add i32 [[P0]], [[P1]]
17 ; CHECK-NEXT: ret i32 [[R]]
20 br i1 %b, label %if, label %then
26 %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
27 %p1 = phi i32 [ 17, %if ], [ %y, %entry ]
32 define i32 @add_const_incoming0_nonspeculative(i1 %b, i32 %x, i32 %y) {
33 ; CHECK-LABEL: @add_const_incoming0_nonspeculative(
35 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
37 ; CHECK-NEXT: br label [[THEN]]
39 ; CHECK-NEXT: [[P0:%.*]] = phi i32 [ 42, [[ENTRY:%.*]] ], [ [[X:%.*]], [[IF]] ]
40 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ 17, [[ENTRY]] ], [ [[Y:%.*]], [[IF]] ]
41 ; CHECK-NEXT: [[R:%.*]] = add i32 [[P0]], [[P1]]
42 ; CHECK-NEXT: ret i32 [[R]]
45 br i1 %b, label %if, label %then
51 %p0 = phi i32 [ 42, %entry ], [ %x, %if ]
52 %p1 = phi i32 [ 17, %entry ], [ %y, %if ]
57 define i32 @sub_const_incoming0(i1 %b, i32 %x, i32 %y) {
58 ; CHECK-LABEL: @sub_const_incoming0(
60 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
62 ; CHECK-NEXT: br label [[THEN]]
64 ; CHECK-NEXT: [[P0:%.*]] = phi i32 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
65 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ 17, [[IF]] ], [ [[Y:%.*]], [[ENTRY]] ]
66 ; CHECK-NEXT: [[R:%.*]] = sub i32 [[P1]], [[P0]]
67 ; CHECK-NEXT: ret i32 [[R]]
70 br i1 %b, label %if, label %then
76 %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
77 %p1 = phi i32 [ 17, %if ], [ %y, %entry ]
82 define i32 @sub_const_incoming1(i1 %b, i32 %x, i32 %y) {
83 ; CHECK-LABEL: @sub_const_incoming1(
85 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
87 ; CHECK-NEXT: br label [[THEN]]
89 ; CHECK-NEXT: [[P0:%.*]] = phi i32 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
90 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ [[Y:%.*]], [[IF]] ], [ 17, [[ENTRY]] ]
91 ; CHECK-NEXT: [[R:%.*]] = sub i32 [[P0]], [[P1]]
92 ; CHECK-NEXT: ret i32 [[R]]
95 br i1 %b, label %if, label %then
101 %p0 = phi i32 [ %x, %if ], [ 42, %entry ]
102 %p1 = phi i32 [ %y, %if ], [ 17, %entry ]
103 %r = sub i32 %p0, %p1
107 define i8 @mul_const_incoming1(i1 %b, i8 %x, i8 %y) {
108 ; CHECK-LABEL: @mul_const_incoming1(
110 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
112 ; CHECK-NEXT: br label [[THEN]]
114 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
115 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 17, [[ENTRY]] ]
116 ; CHECK-NEXT: [[R:%.*]] = mul i8 [[P0]], [[P1]]
117 ; CHECK-NEXT: ret i8 [[R]]
120 br i1 %b, label %if, label %then
126 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
127 %p1 = phi i8 [ %y, %if ], [ 17, %entry ]
132 define i8 @and_const_incoming1(i1 %b, i8 %x, i8 %y) {
133 ; CHECK-LABEL: @and_const_incoming1(
135 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
137 ; CHECK-NEXT: br label [[THEN]]
139 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
140 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 17, [[ENTRY]] ]
141 ; CHECK-NEXT: [[R:%.*]] = and i8 [[P0]], [[P1]]
142 ; CHECK-NEXT: ret i8 [[R]]
145 br i1 %b, label %if, label %then
151 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
152 %p1 = phi i8 [ %y, %if ], [ 17, %entry ]
157 define i8 @xor_const_incoming1(i1 %b, i8 %x, i8 %y) {
158 ; CHECK-LABEL: @xor_const_incoming1(
160 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
162 ; CHECK-NEXT: br label [[THEN]]
164 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
165 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 17, [[ENTRY]] ]
166 ; CHECK-NEXT: [[R:%.*]] = xor i8 [[P0]], [[P1]]
167 ; CHECK-NEXT: ret i8 [[R]]
170 br i1 %b, label %if, label %then
176 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
177 %p1 = phi i8 [ %y, %if ], [ 17, %entry ]
182 define i64 @or_const_incoming1(i1 %b, i64 %x, i64 %y) {
183 ; CHECK-LABEL: @or_const_incoming1(
185 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
187 ; CHECK-NEXT: br label [[THEN]]
189 ; CHECK-NEXT: [[P0:%.*]] = phi i64 [ [[X:%.*]], [[IF]] ], [ 3, [[ENTRY:%.*]] ]
190 ; CHECK-NEXT: [[P1:%.*]] = phi i64 [ [[Y:%.*]], [[IF]] ], [ 16, [[ENTRY]] ]
191 ; CHECK-NEXT: [[R:%.*]] = or i64 [[P0]], [[P1]]
192 ; CHECK-NEXT: ret i64 [[R]]
195 br i1 %b, label %if, label %then
201 %p0 = phi i64 [ %x, %if ], [ 3, %entry ]
202 %p1 = phi i64 [ %y, %if ], [ 16, %entry ]
207 define i64 @or_const_incoming01(i1 %b, i64 %x, i64 %y) {
208 ; CHECK-LABEL: @or_const_incoming01(
210 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
212 ; CHECK-NEXT: br label [[THEN]]
214 ; CHECK-NEXT: [[P0:%.*]] = phi i64 [ 3, [[ENTRY:%.*]] ], [ [[X:%.*]], [[IF]] ]
215 ; CHECK-NEXT: [[P1:%.*]] = phi i64 [ 16, [[ENTRY]] ], [ [[Y:%.*]], [[IF]] ]
216 ; CHECK-NEXT: [[R:%.*]] = or i64 [[P0]], [[P1]]
217 ; CHECK-NEXT: ret i64 [[R]]
220 br i1 %b, label %if, label %then
226 %p0 = phi i64 [ 3, %entry ], [ %x, %if]
227 %p1 = phi i64 [ %y, %if ], [ 16, %entry ]
232 define i64 @or_const_incoming10(i1 %b, i64 %x, i64 %y) {
233 ; CHECK-LABEL: @or_const_incoming10(
235 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
237 ; CHECK-NEXT: br label [[THEN]]
239 ; CHECK-NEXT: [[P0:%.*]] = phi i64 [ [[Y:%.*]], [[IF]] ], [ 16, [[ENTRY:%.*]] ]
240 ; CHECK-NEXT: [[P1:%.*]] = phi i64 [ [[X:%.*]], [[IF]] ], [ 3, [[ENTRY]] ]
241 ; CHECK-NEXT: [[R:%.*]] = or i64 [[P0]], [[P1]]
242 ; CHECK-NEXT: ret i64 [[R]]
245 br i1 %b, label %if, label %then
251 %p0 = phi i64 [ %y, %if ], [ 16, %entry ]
252 %p1 = phi i64 [ 3, %entry ], [ %x, %if]
257 define i8 @ashr_const_incoming0_speculative(i1 %b, i8 %x, i8 %y) {
258 ; CHECK-LABEL: @ashr_const_incoming0_speculative(
260 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
262 ; CHECK-NEXT: br label [[THEN]]
264 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
265 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ 3, [[IF]] ], [ [[Y:%.*]], [[ENTRY]] ]
266 ; CHECK-NEXT: [[R:%.*]] = ashr i8 [[P0]], [[P1]]
267 ; CHECK-NEXT: ret i8 [[R]]
270 br i1 %b, label %if, label %then
276 %p0 = phi i8 [ 42, %if ], [ %x, %entry ]
277 %p1 = phi i8 [ 3, %if ], [ %y, %entry ]
278 %r = ashr i8 %p0, %p1
282 define i8 @ashr_const_incoming0(i1 %b, i8 %x, i8 %y) {
283 ; CHECK-LABEL: @ashr_const_incoming0(
285 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
287 ; CHECK-NEXT: br label [[THEN]]
289 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ 42, [[ENTRY:%.*]] ], [ [[X:%.*]], [[IF]] ]
290 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ 3, [[ENTRY]] ], [ [[Y:%.*]], [[IF]] ]
291 ; CHECK-NEXT: [[R:%.*]] = ashr i8 [[P0]], [[P1]]
292 ; CHECK-NEXT: ret i8 [[R]]
295 br i1 %b, label %if, label %then
301 %p0 = phi i8 [ 42, %entry ], [ %x, %if ]
302 %p1 = phi i8 [ 3, %entry ], [ %y, %if ]
303 %r = ashr i8 %p0, %p1
307 define i8 @lshr_const_incoming1(i1 %b, i8 %x, i8 %y) {
308 ; CHECK-LABEL: @lshr_const_incoming1(
310 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
312 ; CHECK-NEXT: br label [[THEN]]
314 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
315 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 3, [[ENTRY]] ]
316 ; CHECK-NEXT: [[R:%.*]] = lshr i8 [[P0]], [[P1]]
317 ; CHECK-NEXT: ret i8 [[R]]
320 br i1 %b, label %if, label %then
326 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
327 %p1 = phi i8 [ %y, %if ], [ 3, %entry ]
328 %r = lshr i8 %p0, %p1
332 define i8 @shl_const_incoming1(i1 %b, i8 %x, i8 %y) {
333 ; CHECK-LABEL: @shl_const_incoming1(
335 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
337 ; CHECK-NEXT: br label [[THEN]]
339 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
340 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 3, [[ENTRY]] ]
341 ; CHECK-NEXT: [[R:%.*]] = shl nuw nsw i8 [[P0]], [[P1]]
342 ; CHECK-NEXT: ret i8 [[R]]
345 br i1 %b, label %if, label %then
351 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
352 %p1 = phi i8 [ %y, %if ], [ 3, %entry ]
353 %r = shl nsw nuw i8 %p0, %p1
357 define i8 @sdiv_not_safe_to_speculate(i1 %b, i8 %x, i8 %y) {
358 ; CHECK-LABEL: @sdiv_not_safe_to_speculate(
360 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
362 ; CHECK-NEXT: br label [[THEN]]
364 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
365 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ 3, [[IF]] ], [ [[Y:%.*]], [[ENTRY]] ]
366 ; CHECK-NEXT: [[R:%.*]] = sdiv exact i8 [[P0]], [[P1]]
367 ; CHECK-NEXT: ret i8 [[R]]
370 br i1 %b, label %if, label %then
376 %p0 = phi i8 [ 42, %if ], [ %x, %entry ]
377 %p1 = phi i8 [ 3, %if ], [ %y, %entry ]
378 %r = sdiv exact i8 %p0, %p1
382 define i8 @sdiv_const_incoming1(i1 %b, i8 %x, i8 %y) {
383 ; CHECK-LABEL: @sdiv_const_incoming1(
385 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
387 ; CHECK-NEXT: br label [[THEN]]
389 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ -42, [[ENTRY:%.*]] ]
390 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 17, [[ENTRY]] ]
391 ; CHECK-NEXT: [[R:%.*]] = sdiv i8 [[P0]], [[P1]]
392 ; CHECK-NEXT: ret i8 [[R]]
395 br i1 %b, label %if, label %then
401 %p0 = phi i8 [ %x, %if ], [ -42, %entry ]
402 %p1 = phi i8 [ %y, %if ], [ 17, %entry ]
403 %r = sdiv i8 %p0, %p1
407 define i8 @udiv_const_incoming1(i1 %b, i8 %x, i8 %y) {
408 ; CHECK-LABEL: @udiv_const_incoming1(
410 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
412 ; CHECK-NEXT: br label [[THEN]]
414 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ -42, [[ENTRY:%.*]] ]
415 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ 17, [[ENTRY]] ]
416 ; CHECK-NEXT: [[R:%.*]] = udiv i8 [[P0]], [[P1]]
417 ; CHECK-NEXT: ret i8 [[R]]
420 br i1 %b, label %if, label %then
426 %p0 = phi i8 [ %x, %if ], [ -42, %entry ]
427 %p1 = phi i8 [ %y, %if ], [ 17, %entry ]
428 %r = udiv i8 %p0, %p1
432 define i8 @srem_const_incoming1(i1 %b, i8 %x, i8 %y) {
433 ; CHECK-LABEL: @srem_const_incoming1(
435 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
437 ; CHECK-NEXT: br label [[THEN]]
439 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
440 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ -17, [[ENTRY]] ]
441 ; CHECK-NEXT: [[R:%.*]] = srem i8 [[P0]], [[P1]]
442 ; CHECK-NEXT: ret i8 [[R]]
445 br i1 %b, label %if, label %then
451 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
452 %p1 = phi i8 [ %y, %if ], [ -17, %entry ]
453 %r = srem i8 %p0, %p1
457 define i8 @urem_const_incoming1(i1 %b, i8 %x, i8 %y) {
458 ; CHECK-LABEL: @urem_const_incoming1(
460 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
462 ; CHECK-NEXT: br label [[THEN]]
464 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ [[X:%.*]], [[IF]] ], [ 42, [[ENTRY:%.*]] ]
465 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ [[Y:%.*]], [[IF]] ], [ -17, [[ENTRY]] ]
466 ; CHECK-NEXT: [[R:%.*]] = urem i8 [[P0]], [[P1]]
467 ; CHECK-NEXT: ret i8 [[R]]
470 br i1 %b, label %if, label %then
476 %p0 = phi i8 [ %x, %if ], [ 42, %entry ]
477 %p1 = phi i8 [ %y, %if ], [ -17, %entry ]
478 %r = urem i8 %p0, %p1
482 define float @fmul_const_incoming1(i1 %b, float %x, float %y) {
483 ; CHECK-LABEL: @fmul_const_incoming1(
485 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
487 ; CHECK-NEXT: br label [[THEN]]
489 ; CHECK-NEXT: [[P0:%.*]] = phi float [ [[X:%.*]], [[IF]] ], [ 4.200000e+01, [[ENTRY:%.*]] ]
490 ; CHECK-NEXT: [[P1:%.*]] = phi float [ [[Y:%.*]], [[IF]] ], [ 1.700000e+01, [[ENTRY]] ]
491 ; CHECK-NEXT: [[R:%.*]] = fmul float [[P0]], [[P1]]
492 ; CHECK-NEXT: ret float [[R]]
495 br i1 %b, label %if, label %then
501 %p0 = phi float [ %x, %if ], [ 42.0, %entry ]
502 %p1 = phi float [ %y, %if ], [ 17.0, %entry ]
503 %r = fmul float %p0, %p1
507 define float @fadd_const_incoming1(i1 %b, float %x, float %y) {
508 ; CHECK-LABEL: @fadd_const_incoming1(
510 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
512 ; CHECK-NEXT: br label [[THEN]]
514 ; CHECK-NEXT: [[P0:%.*]] = phi float [ [[X:%.*]], [[IF]] ], [ 4.200000e+01, [[ENTRY:%.*]] ]
515 ; CHECK-NEXT: [[P1:%.*]] = phi float [ [[Y:%.*]], [[IF]] ], [ 1.700000e+01, [[ENTRY]] ]
516 ; CHECK-NEXT: [[R:%.*]] = fadd fast float [[P0]], [[P1]]
517 ; CHECK-NEXT: ret float [[R]]
520 br i1 %b, label %if, label %then
526 %p0 = phi float [ %x, %if ], [ 42.0, %entry ]
527 %p1 = phi float [ %y, %if ], [ 17.0, %entry ]
528 %r = fadd fast float %p0, %p1
532 define float @fsub_const_incoming1(i1 %b, float %x, float %y) {
533 ; CHECK-LABEL: @fsub_const_incoming1(
535 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
537 ; CHECK-NEXT: br label [[THEN]]
539 ; CHECK-NEXT: [[P0:%.*]] = phi float [ [[X:%.*]], [[IF]] ], [ 4.200000e+01, [[ENTRY:%.*]] ]
540 ; CHECK-NEXT: [[P1:%.*]] = phi float [ [[Y:%.*]], [[IF]] ], [ 1.700000e+01, [[ENTRY]] ]
541 ; CHECK-NEXT: [[R:%.*]] = fsub nnan ninf float [[P0]], [[P1]]
542 ; CHECK-NEXT: ret float [[R]]
545 br i1 %b, label %if, label %then
551 %p0 = phi float [ %x, %if ], [ 42.0, %entry ]
552 %p1 = phi float [ %y, %if ], [ 17.0, %entry ]
553 %r = fsub ninf nnan float %p0, %p1
557 define float @frem_const_incoming1(i1 %b, float %x, float %y) {
558 ; CHECK-LABEL: @frem_const_incoming1(
560 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
562 ; CHECK-NEXT: br label [[THEN]]
564 ; CHECK-NEXT: [[P0:%.*]] = phi float [ [[X:%.*]], [[IF]] ], [ 4.200000e+01, [[ENTRY:%.*]] ]
565 ; CHECK-NEXT: [[P1:%.*]] = phi float [ [[Y:%.*]], [[IF]] ], [ 1.700000e+01, [[ENTRY]] ]
566 ; CHECK-NEXT: [[R:%.*]] = frem nsz float [[P0]], [[P1]]
567 ; CHECK-NEXT: ret float [[R]]
570 br i1 %b, label %if, label %then
576 %p0 = phi float [ %x, %if ], [ 42.0, %entry ]
577 %p1 = phi float [ %y, %if ], [ 17.0, %entry ]
578 %r = frem nsz float %p0, %p1
582 define i32 @add_const_incoming0_use1(i1 %b, i32 %x, i32 %y) {
583 ; CHECK-LABEL: @add_const_incoming0_use1(
585 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
587 ; CHECK-NEXT: br label [[THEN]]
589 ; CHECK-NEXT: [[P0:%.*]] = phi i32 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
590 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ 17, [[IF]] ], [ [[Y:%.*]], [[ENTRY]] ]
591 ; CHECK-NEXT: call void @use(i32 [[P0]])
592 ; CHECK-NEXT: [[R:%.*]] = add i32 [[P0]], [[P1]]
593 ; CHECK-NEXT: ret i32 [[R]]
596 br i1 %b, label %if, label %then
602 %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
603 %p1 = phi i32 [ 17, %if ], [ %y, %entry ]
604 call void @use(i32 %p0)
605 %r = add i32 %p0, %p1
609 define i32 @add_const_incoming0_use2(i1 %b, i32 %x, i32 %y) {
610 ; CHECK-LABEL: @add_const_incoming0_use2(
612 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
614 ; CHECK-NEXT: br label [[THEN]]
616 ; CHECK-NEXT: [[P0:%.*]] = phi i32 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
617 ; CHECK-NEXT: [[P1:%.*]] = phi i32 [ 17, [[IF]] ], [ [[Y:%.*]], [[ENTRY]] ]
618 ; CHECK-NEXT: call void @use(i32 [[P1]])
619 ; CHECK-NEXT: [[R:%.*]] = add i32 [[P0]], [[P1]]
620 ; CHECK-NEXT: ret i32 [[R]]
623 br i1 %b, label %if, label %then
629 %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
630 %p1 = phi i32 [ 17, %if ], [ %y, %entry ]
631 call void @use(i32 %p1)
632 %r = add i32 %p0, %p1
636 define i64 @or_notconst_incoming(i1 %b, i64 %x, i64 %y) {
637 ; CHECK-LABEL: @or_notconst_incoming(
639 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
641 ; CHECK-NEXT: br label [[THEN]]
643 ; CHECK-NEXT: [[P0:%.*]] = phi i64 [ 42, [[IF]] ], [ [[X:%.*]], [[ENTRY:%.*]] ]
644 ; CHECK-NEXT: [[P1:%.*]] = phi i64 [ [[Y:%.*]], [[IF]] ], [ 43, [[ENTRY]] ]
645 ; CHECK-NEXT: [[R:%.*]] = or i64 [[P0]], [[P1]]
646 ; CHECK-NEXT: ret i64 [[R]]
649 br i1 %b, label %if, label %then
655 %p0 = phi i64 [ 42, %if ], [ %x, %entry ]
656 %p1 = phi i64 [ %y, %if ], [ 43, %entry ]
661 define i8 @mul_const_incoming0_speculatable(i1 %b, i8 %x, i8 %y) {
662 ; CHECK-LABEL: @mul_const_incoming0_speculatable(
664 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
666 ; CHECK-NEXT: br label [[THEN]]
668 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ 42, [[ENTRY:%.*]] ], [ [[X:%.*]], [[IF]] ]
669 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ 17, [[ENTRY]] ], [ [[Y:%.*]], [[IF]] ]
670 ; CHECK-NEXT: call void @sideeffect()
671 ; CHECK-NEXT: [[R:%.*]] = mul i8 [[P0]], [[P1]]
672 ; CHECK-NEXT: ret i8 [[R]]
675 br i1 %b, label %if, label %then
681 %p0 = phi i8 [ 42, %entry ], [ %x, %if ]
682 %p1 = phi i8 [ 17, %entry ], [ %y, %if ]
683 call void @sideeffect()
688 define i8 @udiv_const_incoming0_not_speculatable(i1 %b, i8 %x, i8 %y) {
689 ; CHECK-LABEL: @udiv_const_incoming0_not_speculatable(
691 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
693 ; CHECK-NEXT: br label [[THEN]]
695 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ 42, [[ENTRY:%.*]] ], [ [[X:%.*]], [[IF]] ]
696 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ 17, [[ENTRY]] ], [ [[Y:%.*]], [[IF]] ]
697 ; CHECK-NEXT: call void @sideeffect()
698 ; CHECK-NEXT: [[R:%.*]] = udiv i8 [[P0]], [[P1]]
699 ; CHECK-NEXT: ret i8 [[R]]
702 br i1 %b, label %if, label %then
708 %p0 = phi i8 [ 42, %entry ], [ %x, %if ]
709 %p1 = phi i8 [ 17, %entry ], [ %y, %if ]
710 call void @sideeffect()
711 %r = udiv i8 %p0, %p1
715 define i8 @udiv_const_incoming0_different_block(i1 %b, i8 %x, i8 %y) {
716 ; CHECK-LABEL: @udiv_const_incoming0_different_block(
718 ; CHECK-NEXT: br i1 [[B:%.*]], label [[IF:%.*]], label [[THEN:%.*]]
720 ; CHECK-NEXT: br label [[THEN]]
722 ; CHECK-NEXT: [[P0:%.*]] = phi i8 [ 42, [[ENTRY:%.*]] ], [ [[X:%.*]], [[IF]] ]
723 ; CHECK-NEXT: [[P1:%.*]] = phi i8 [ 17, [[ENTRY]] ], [ [[Y:%.*]], [[IF]] ]
724 ; CHECK-NEXT: br label [[END:%.*]]
726 ; CHECK-NEXT: [[R:%.*]] = udiv i8 [[P0]], [[P1]]
727 ; CHECK-NEXT: ret i8 [[R]]
730 br i1 %b, label %if, label %then
736 %p0 = phi i8 [ 42, %entry ], [ %x, %if ]
737 %p1 = phi i8 [ 17, %entry ], [ %y, %if ]
741 %r = udiv i8 %p0, %p1
745 define { i64, i32 } @ParseRetVal(i1 %b, { i64, i32 } ()* %x) {
746 ; CHECK-LABEL: @ParseRetVal(
748 ; CHECK-NEXT: br i1 [[B:%.*]], label [[T:%.*]], label [[F:%.*]]
750 ; CHECK-NEXT: [[T4:%.*]] = tail call { i64, i32 } [[X:%.*]]()
751 ; CHECK-NEXT: [[T5:%.*]] = extractvalue { i64, i32 } [[T4]], 0
752 ; CHECK-NEXT: [[T6:%.*]] = extractvalue { i64, i32 } [[T4]], 1
753 ; CHECK-NEXT: [[T7:%.*]] = and i64 [[T5]], -4294967296
754 ; CHECK-NEXT: [[T8:%.*]] = and i64 [[T5]], 4294901760
755 ; CHECK-NEXT: [[T9:%.*]] = and i64 [[T5]], 65280
756 ; CHECK-NEXT: [[T10:%.*]] = and i64 [[T5]], 255
757 ; CHECK-NEXT: br label [[F]]
759 ; CHECK-NEXT: [[T12:%.*]] = phi i64 [ [[T10]], [[T]] ], [ 0, [[ENTRY:%.*]] ]
760 ; CHECK-NEXT: [[T13:%.*]] = phi i64 [ [[T9]], [[T]] ], [ 0, [[ENTRY]] ]
761 ; CHECK-NEXT: [[T14:%.*]] = phi i64 [ [[T8]], [[T]] ], [ 0, [[ENTRY]] ]
762 ; CHECK-NEXT: [[T15:%.*]] = phi i64 [ [[T7]], [[T]] ], [ 0, [[ENTRY]] ]
763 ; CHECK-NEXT: [[T16:%.*]] = phi i32 [ [[T6]], [[T]] ], [ 0, [[ENTRY]] ]
764 ; CHECK-NEXT: [[T17:%.*]] = or i64 [[T13]], [[T12]]
765 ; CHECK-NEXT: [[T18:%.*]] = or i64 [[T17]], [[T14]]
766 ; CHECK-NEXT: [[T19:%.*]] = or i64 [[T18]], [[T15]]
767 ; CHECK-NEXT: [[T20:%.*]] = insertvalue { i64, i32 } poison, i64 [[T19]], 0
768 ; CHECK-NEXT: [[T21:%.*]] = insertvalue { i64, i32 } [[T20]], i32 [[T16]], 1
769 ; CHECK-NEXT: ret { i64, i32 } [[T21]]
772 br i1 %b, label %t, label %f
775 %t4 = tail call { i64, i32 } %x()
776 %t5 = extractvalue { i64, i32 } %t4, 0
777 %t6 = extractvalue { i64, i32 } %t4, 1
778 %t7 = and i64 %t5, -4294967296
779 %t8 = and i64 %t5, 4294901760
780 %t9 = and i64 %t5, 65280
781 %t10 = and i64 %t5, 255
785 %t12 = phi i64 [ %t10, %t ], [ 0, %entry ]
786 %t13 = phi i64 [ %t9, %t ], [ 0, %entry ]
787 %t14 = phi i64 [ %t8, %t ], [ 0, %entry ]
788 %t15 = phi i64 [ %t7, %t ], [ 0, %entry ]
789 %t16 = phi i32 [ %t6, %t ], [ 0, %entry ]
790 %t17 = or i64 %t13, %t12
791 %t18 = or i64 %t17, %t14
792 %t19 = or i64 %t18, %t15
793 %t20 = insertvalue { i64, i32 } poison, i64 %t19, 0
794 %t21 = insertvalue { i64, i32 } %t20, i32 %t16, 1
795 ret { i64, i32 } %t21