1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
6 declare i32 @llvm.smax.i32(i32 %a, i32 %b)
7 declare i32 @llvm.smin.i32(i32 %a, i32 %b)
8 declare i32 @llvm.umax.i32(i32 %a, i32 %b)
9 declare i32 @llvm.umin.i32(i32 %a, i32 %b)
10 declare float @llvm.maxnum.f32(float %a, float %b)
11 declare float @llvm.minnum.f32(float %a, float %b)
12 declare float @llvm.maximum.f32(float %a, float %b)
13 declare float @llvm.minimum.f32(float %a, float %b)
14 declare float @llvm.pow.f32(float %a, float %b)
16 define i8 @fold_phi_mul(i1 %c, i8 %a, i8 %b) {
17 ; CHECK-LABEL: define i8 @fold_phi_mul(
18 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
20 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
22 ; CHECK-NEXT: call void @dummy()
23 ; CHECK-NEXT: br label [[END]]
25 ; CHECK-NEXT: [[RET:%.*]] = mul i8 [[A]], [[B]]
26 ; CHECK-NEXT: ret i8 [[RET]]
29 br i1 %c, label %then, label %end
34 %phi1 = phi i8 [%a, %entry], [%b, %then]
35 %phi2 = phi i8 [%b, %entry], [%a, %then]
36 %ret = mul i8 %phi1, %phi2
40 define i8 @fold_phi_mul_three(i1 %c, i1 %d, i8 %a, i8 %b) {
41 ; CHECK-LABEL: define i8 @fold_phi_mul_three(
42 ; CHECK-SAME: i1 [[C:%.*]], i1 [[D:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
44 ; CHECK-NEXT: br i1 [[C]], label [[THEN1:%.*]], label [[END:%.*]]
46 ; CHECK-NEXT: call void @dummy()
47 ; CHECK-NEXT: br i1 [[D]], label [[THEN2:%.*]], label [[END]]
49 ; CHECK-NEXT: call void @dummy()
50 ; CHECK-NEXT: br label [[END]]
52 ; CHECK-NEXT: [[RET:%.*]] = mul i8 [[A]], [[B]]
53 ; CHECK-NEXT: ret i8 [[RET]]
56 br i1 %c, label %then1, label %end
59 br i1 %d, label %then2, label %end
64 %phi1 = phi i8 [%a, %entry], [%b, %then1], [%a, %then2]
65 %phi2 = phi i8 [%b, %entry], [%a, %then1], [%b, %then2]
66 %ret = mul i8 %phi1, %phi2
70 define i8 @fold_phi_mul_three_notopt(i1 %c, i1 %d, i8 %a, i8 %b) {
71 ; CHECK-LABEL: define i8 @fold_phi_mul_three_notopt(
72 ; CHECK-SAME: i1 [[C:%.*]], i1 [[D:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
74 ; CHECK-NEXT: br i1 [[C]], label [[THEN1:%.*]], label [[END:%.*]]
76 ; CHECK-NEXT: call void @dummy()
77 ; CHECK-NEXT: br i1 [[D]], label [[THEN2:%.*]], label [[END]]
79 ; CHECK-NEXT: call void @dummy()
80 ; CHECK-NEXT: br label [[END]]
82 ; CHECK-NEXT: [[PHI1:%.*]] = phi i8 [ [[A]], [[ENTRY:%.*]] ], [ [[B]], [[THEN1]] ], [ [[A]], [[THEN2]] ]
83 ; CHECK-NEXT: [[PHI2:%.*]] = phi i8 [ [[B]], [[ENTRY]] ], [ [[A]], [[THEN1]] ], [ [[A]], [[THEN2]] ]
84 ; CHECK-NEXT: [[RET:%.*]] = mul i8 [[PHI1]], [[PHI2]]
85 ; CHECK-NEXT: ret i8 [[RET]]
88 br i1 %c, label %then1, label %end
91 br i1 %d, label %then2, label %end
96 %phi1 = phi i8 [%a, %entry], [%b, %then1], [%a, %then2]
97 %phi2 = phi i8 [%b, %entry], [%a, %then1], [%a, %then2]
98 %ret = mul i8 %phi1, %phi2
102 define i8 @fold_phi_mul_nsw_nuw(i1 %c, i8 %a, i8 %b) {
103 ; CHECK-LABEL: define i8 @fold_phi_mul_nsw_nuw(
104 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
106 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
108 ; CHECK-NEXT: call void @dummy()
109 ; CHECK-NEXT: br label [[END]]
111 ; CHECK-NEXT: [[RET:%.*]] = mul nuw nsw i8 [[A]], [[B]]
112 ; CHECK-NEXT: ret i8 [[RET]]
115 br i1 %c, label %then, label %end
120 %phi1 = phi i8 [%a, %entry], [%b, %then]
121 %phi2 = phi i8 [%b, %entry], [%a, %then]
122 %ret = mul nsw nuw i8 %phi1, %phi2
126 define <2 x i8> @fold_phi_mul_fix_vec(i1 %c, <2 x i8> %a, <2 x i8> %b) {
127 ; CHECK-LABEL: define <2 x i8> @fold_phi_mul_fix_vec(
128 ; CHECK-SAME: i1 [[C:%.*]], <2 x i8> [[A:%.*]], <2 x i8> [[B:%.*]]) {
130 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
132 ; CHECK-NEXT: call void @dummy()
133 ; CHECK-NEXT: br label [[END]]
135 ; CHECK-NEXT: [[RET:%.*]] = mul <2 x i8> [[A]], [[B]]
136 ; CHECK-NEXT: ret <2 x i8> [[RET]]
139 br i1 %c, label %then, label %end
144 %phi1 = phi <2 x i8> [%a, %entry], [%b, %then]
145 %phi2 = phi <2 x i8> [%b, %entry], [%a, %then]
146 %ret = mul <2 x i8> %phi1, %phi2
150 define <vscale x 2 x i8> @fold_phi_mul_scale_vec(i1 %c, <vscale x 2 x i8> %a, <vscale x 2 x i8> %b) {
151 ; CHECK-LABEL: define <vscale x 2 x i8> @fold_phi_mul_scale_vec(
152 ; CHECK-SAME: i1 [[C:%.*]], <vscale x 2 x i8> [[A:%.*]], <vscale x 2 x i8> [[B:%.*]]) {
154 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
156 ; CHECK-NEXT: call void @dummy()
157 ; CHECK-NEXT: br label [[END]]
159 ; CHECK-NEXT: [[RET:%.*]] = mul <vscale x 2 x i8> [[A]], [[B]]
160 ; CHECK-NEXT: ret <vscale x 2 x i8> [[RET]]
163 br i1 %c, label %then, label %end
168 %phi1 = phi <vscale x 2 x i8> [%a, %entry], [%b, %then]
169 %phi2 = phi <vscale x 2 x i8> [%b, %entry], [%a, %then]
170 %ret = mul <vscale x 2 x i8> %phi1, %phi2
171 ret <vscale x 2 x i8> %ret
174 define i8 @fold_phi_mul_commute(i1 %c, i8 %a, i8 %b) {
175 ; CHECK-LABEL: define i8 @fold_phi_mul_commute(
176 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
178 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
180 ; CHECK-NEXT: call void @dummy()
181 ; CHECK-NEXT: br label [[END]]
183 ; CHECK-NEXT: [[RET:%.*]] = mul i8 [[A]], [[B]]
184 ; CHECK-NEXT: ret i8 [[RET]]
187 br i1 %c, label %then, label %end
192 %phi1 = phi i8 [%a, %entry], [%b, %then]
193 %phi2 = phi i8 [%a, %then], [%b, %entry]
194 %ret = mul i8 %phi1, %phi2
199 define i8 @fold_phi_mul_notopt(i1 %c, i8 %a, i8 %b, i8 %d) {
200 ; CHECK-LABEL: define i8 @fold_phi_mul_notopt(
201 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]], i8 [[D:%.*]]) {
203 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
205 ; CHECK-NEXT: call void @dummy()
206 ; CHECK-NEXT: br label [[END]]
208 ; CHECK-NEXT: [[PHI1:%.*]] = phi i8 [ [[A]], [[ENTRY:%.*]] ], [ [[B]], [[THEN]] ]
209 ; CHECK-NEXT: [[PHI2:%.*]] = phi i8 [ [[B]], [[ENTRY]] ], [ [[D]], [[THEN]] ]
210 ; CHECK-NEXT: [[RET:%.*]] = mul i8 [[PHI1]], [[PHI2]]
211 ; CHECK-NEXT: ret i8 [[RET]]
214 br i1 %c, label %then, label %end
219 %phi1 = phi i8 [%a, %entry], [%b, %then]
220 %phi2 = phi i8 [%b, %entry], [%d, %then]
221 %ret = mul i8 %phi1, %phi2
226 define i8 @fold_phi_sub(i1 %c, i8 %a, i8 %b) {
227 ; CHECK-LABEL: define i8 @fold_phi_sub(
228 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
230 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
232 ; CHECK-NEXT: call void @dummy()
233 ; CHECK-NEXT: br label [[END]]
235 ; CHECK-NEXT: [[PHI1:%.*]] = phi i8 [ [[A]], [[ENTRY:%.*]] ], [ [[B]], [[THEN]] ]
236 ; CHECK-NEXT: [[PHI2:%.*]] = phi i8 [ [[B]], [[ENTRY]] ], [ [[A]], [[THEN]] ]
237 ; CHECK-NEXT: [[RET:%.*]] = sub i8 [[PHI1]], [[PHI2]]
238 ; CHECK-NEXT: ret i8 [[RET]]
241 br i1 %c, label %then, label %end
246 %phi1 = phi i8 [%a, %entry], [%b, %then]
247 %phi2 = phi i8 [%b, %entry], [%a, %then]
248 %ret = sub i8 %phi1, %phi2
253 define i8 @fold_phi_add(i1 %c, i8 %a, i8 %b) {
254 ; CHECK-LABEL: define i8 @fold_phi_add(
255 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
257 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
259 ; CHECK-NEXT: call void @dummy()
260 ; CHECK-NEXT: br label [[END]]
262 ; CHECK-NEXT: [[RET:%.*]] = add i8 [[A]], [[B]]
263 ; CHECK-NEXT: ret i8 [[RET]]
266 br i1 %c, label %then, label %end
271 %phi1 = phi i8 [%a, %entry], [%b, %then]
272 %phi2 = phi i8 [%b, %entry], [%a, %then]
273 %ret = add i8 %phi1, %phi2
277 define i8 @fold_phi_and(i1 %c, i8 %a, i8 %b) {
278 ; CHECK-LABEL: define i8 @fold_phi_and(
279 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
281 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
283 ; CHECK-NEXT: call void @dummy()
284 ; CHECK-NEXT: br label [[END]]
286 ; CHECK-NEXT: [[RET:%.*]] = and i8 [[A]], [[B]]
287 ; CHECK-NEXT: ret i8 [[RET]]
290 br i1 %c, label %then, label %end
295 %phi1 = phi i8 [%a, %entry], [%b, %then]
296 %phi2 = phi i8 [%b, %entry], [%a, %then]
297 %ret = and i8 %phi1, %phi2
301 define i8 @fold_phi_or(i1 %c, i8 %a, i8 %b) {
302 ; CHECK-LABEL: define i8 @fold_phi_or(
303 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
305 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
307 ; CHECK-NEXT: call void @dummy()
308 ; CHECK-NEXT: br label [[END]]
310 ; CHECK-NEXT: [[RET:%.*]] = or i8 [[A]], [[B]]
311 ; CHECK-NEXT: ret i8 [[RET]]
314 br i1 %c, label %then, label %end
319 %phi1 = phi i8 [%a, %entry], [%b, %then]
320 %phi2 = phi i8 [%b, %entry], [%a, %then]
321 %ret = or i8 %phi1, %phi2
326 define i8 @fold_phi_xor(i1 %c, i8 %a, i8 %b) {
327 ; CHECK-LABEL: define i8 @fold_phi_xor(
328 ; CHECK-SAME: i1 [[C:%.*]], i8 [[A:%.*]], i8 [[B:%.*]]) {
330 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
332 ; CHECK-NEXT: call void @dummy()
333 ; CHECK-NEXT: br label [[END]]
335 ; CHECK-NEXT: [[RET:%.*]] = xor i8 [[A]], [[B]]
336 ; CHECK-NEXT: ret i8 [[RET]]
339 br i1 %c, label %then, label %end
344 %phi1 = phi i8 [%a, %entry], [%b, %then]
345 %phi2 = phi i8 [%b, %entry], [%a, %then]
346 %ret = xor i8 %phi1, %phi2
351 define float @fold_phi_fadd(i1 %c, float %a, float %b) {
352 ; CHECK-LABEL: define float @fold_phi_fadd(
353 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
355 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
357 ; CHECK-NEXT: call void @dummy()
358 ; CHECK-NEXT: br label [[END]]
360 ; CHECK-NEXT: [[RET:%.*]] = fadd float [[A]], [[B]]
361 ; CHECK-NEXT: ret float [[RET]]
364 br i1 %c, label %then, label %end
369 %phi1 = phi float [%a, %entry], [%b, %then]
370 %phi2 = phi float [%b, %entry], [%a, %then]
371 %ret = fadd float %phi1, %phi2
375 define float @fold_phi_fadd_nnan(i1 %c, float %a, float %b) {
376 ; CHECK-LABEL: define float @fold_phi_fadd_nnan(
377 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
379 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
381 ; CHECK-NEXT: call void @dummy()
382 ; CHECK-NEXT: br label [[END]]
384 ; CHECK-NEXT: [[RET:%.*]] = fadd nnan float [[A]], [[B]]
385 ; CHECK-NEXT: ret float [[RET]]
388 br i1 %c, label %then, label %end
393 %phi1 = phi float [%a, %entry], [%b, %then]
394 %phi2 = phi float [%b, %entry], [%a, %then]
395 %ret = fadd nnan float %phi1, %phi2
400 define float @fold_phi_fmul(i1 %c, float %a, float %b) {
401 ; CHECK-LABEL: define float @fold_phi_fmul(
402 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
404 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
406 ; CHECK-NEXT: call void @dummy()
407 ; CHECK-NEXT: br label [[END]]
409 ; CHECK-NEXT: [[RET:%.*]] = fmul float [[A]], [[B]]
410 ; CHECK-NEXT: ret float [[RET]]
413 br i1 %c, label %then, label %end
418 %phi1 = phi float [%a, %entry], [%b, %then]
419 %phi2 = phi float [%b, %entry], [%a, %then]
420 %ret = fmul float %phi1, %phi2
425 define i32 @fold_phi_smax(i1 %c, i32 %a, i32 %b) {
426 ; CHECK-LABEL: define i32 @fold_phi_smax(
427 ; CHECK-SAME: i1 [[C:%.*]], i32 [[A:%.*]], i32 [[B:%.*]]) {
429 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
431 ; CHECK-NEXT: call void @dummy()
432 ; CHECK-NEXT: br label [[END]]
434 ; CHECK-NEXT: [[RET:%.*]] = call i32 @llvm.smax.i32(i32 [[A]], i32 [[B]])
435 ; CHECK-NEXT: ret i32 [[RET]]
438 br i1 %c, label %then, label %end
443 %phi1 = phi i32 [%a, %entry], [%b, %then]
444 %phi2 = phi i32 [%b, %entry], [%a, %then]
445 %ret = call i32 @llvm.smax.i32(i32 %phi1, i32 %phi2)
450 define i32 @fold_phi_smin(i1 %c, i32 %a, i32 %b) {
451 ; CHECK-LABEL: define i32 @fold_phi_smin(
452 ; CHECK-SAME: i1 [[C:%.*]], i32 [[A:%.*]], i32 [[B:%.*]]) {
454 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
456 ; CHECK-NEXT: call void @dummy()
457 ; CHECK-NEXT: br label [[END]]
459 ; CHECK-NEXT: [[RET:%.*]] = call i32 @llvm.smin.i32(i32 [[A]], i32 [[B]])
460 ; CHECK-NEXT: ret i32 [[RET]]
463 br i1 %c, label %then, label %end
468 %phi1 = phi i32 [%a, %entry], [%b, %then]
469 %phi2 = phi i32 [%b, %entry], [%a, %then]
470 %ret = call i32 @llvm.smin.i32(i32 %phi1, i32 %phi2)
475 define i32 @fold_phi_umax(i1 %c, i32 %a, i32 %b) {
476 ; CHECK-LABEL: define i32 @fold_phi_umax(
477 ; CHECK-SAME: i1 [[C:%.*]], i32 [[A:%.*]], i32 [[B:%.*]]) {
479 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
481 ; CHECK-NEXT: call void @dummy()
482 ; CHECK-NEXT: br label [[END]]
484 ; CHECK-NEXT: [[RET:%.*]] = call i32 @llvm.umax.i32(i32 [[A]], i32 [[B]])
485 ; CHECK-NEXT: ret i32 [[RET]]
488 br i1 %c, label %then, label %end
493 %phi1 = phi i32 [%a, %entry], [%b, %then]
494 %phi2 = phi i32 [%b, %entry], [%a, %then]
495 %ret = call i32 @llvm.umax.i32(i32 %phi1, i32 %phi2)
499 define i32 @fold_phi_umin(i1 %c, i32 %a, i32 %b) {
500 ; CHECK-LABEL: define i32 @fold_phi_umin(
501 ; CHECK-SAME: i1 [[C:%.*]], i32 [[A:%.*]], i32 [[B:%.*]]) {
503 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
505 ; CHECK-NEXT: call void @dummy()
506 ; CHECK-NEXT: br label [[END]]
508 ; CHECK-NEXT: [[RET:%.*]] = call i32 @llvm.umin.i32(i32 [[A]], i32 [[B]])
509 ; CHECK-NEXT: ret i32 [[RET]]
512 br i1 %c, label %then, label %end
517 %phi1 = phi i32 [%a, %entry], [%b, %then]
518 %phi2 = phi i32 [%b, %entry], [%a, %then]
519 %ret = call i32 @llvm.umin.i32(i32 %phi1, i32 %phi2)
524 define float @fold_phi_maxnum(i1 %c, float %a, float %b) {
525 ; CHECK-LABEL: define float @fold_phi_maxnum(
526 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
528 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
530 ; CHECK-NEXT: call void @dummy()
531 ; CHECK-NEXT: br label [[END]]
533 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.maxnum.f32(float [[A]], float [[B]])
534 ; CHECK-NEXT: ret float [[RET]]
537 br i1 %c, label %then, label %end
542 %phi1 = phi float [%a, %entry], [%b, %then]
543 %phi2 = phi float [%b, %entry], [%a, %then]
544 %ret = call float @llvm.maxnum.f32(float %phi1, float %phi2)
548 define float @fold_phi_pow(i1 %c, float %a, float %b) {
549 ; CHECK-LABEL: define float @fold_phi_pow(
550 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
552 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
554 ; CHECK-NEXT: call void @dummy()
555 ; CHECK-NEXT: br label [[END]]
557 ; CHECK-NEXT: [[PHI1:%.*]] = phi float [ [[A]], [[ENTRY:%.*]] ], [ [[B]], [[THEN]] ]
558 ; CHECK-NEXT: [[PHI2:%.*]] = phi float [ [[B]], [[ENTRY]] ], [ [[A]], [[THEN]] ]
559 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.pow.f32(float [[PHI1]], float [[PHI2]])
560 ; CHECK-NEXT: ret float [[RET]]
563 br i1 %c, label %then, label %end
568 %phi1 = phi float [%a, %entry], [%b, %then]
569 %phi2 = phi float [%b, %entry], [%a, %then]
570 %ret = call float @llvm.pow.f32(float %phi1, float %phi2)
574 define float @fold_phi_minnum(i1 %c, float %a, float %b) {
575 ; CHECK-LABEL: define float @fold_phi_minnum(
576 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
578 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
580 ; CHECK-NEXT: call void @dummy()
581 ; CHECK-NEXT: br label [[END]]
583 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.minnum.f32(float [[A]], float [[B]])
584 ; CHECK-NEXT: ret float [[RET]]
587 br i1 %c, label %then, label %end
592 %phi1 = phi float [%a, %entry], [%b, %then]
593 %phi2 = phi float [%b, %entry], [%a, %then]
594 %ret = call float @llvm.minnum.f32(float %phi1, float %phi2)
598 define float @fold_phi_maximum(i1 %c, float %a, float %b) {
599 ; CHECK-LABEL: define float @fold_phi_maximum(
600 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
602 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
604 ; CHECK-NEXT: call void @dummy()
605 ; CHECK-NEXT: br label [[END]]
607 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.maximum.f32(float [[A]], float [[B]])
608 ; CHECK-NEXT: ret float [[RET]]
611 br i1 %c, label %then, label %end
616 %phi1 = phi float [%a, %entry], [%b, %then]
617 %phi2 = phi float [%b, %entry], [%a, %then]
618 %ret = call float @llvm.maximum.f32(float %phi1, float %phi2)
622 define float @fold_phi_minimum(i1 %c, float %a, float %b) {
623 ; CHECK-LABEL: define float @fold_phi_minimum(
624 ; CHECK-SAME: i1 [[C:%.*]], float [[A:%.*]], float [[B:%.*]]) {
626 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[END:%.*]]
628 ; CHECK-NEXT: call void @dummy()
629 ; CHECK-NEXT: br label [[END]]
631 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.minimum.f32(float [[A]], float [[B]])
632 ; CHECK-NEXT: ret float [[RET]]
635 br i1 %c, label %then, label %end
640 %phi1 = phi float [%a, %entry], [%b, %then]
641 %phi2 = phi float [%b, %entry], [%a, %then]
642 %ret = call float @llvm.minimum.f32(float %phi1, float %phi2)