@@ -382,9 +382,7 @@ define i1 @or_select_false_x_negative(i1 %x, i1 %y, i1 %z) {
382
382
383
383
define i1 @select_or_same_op (i1 %x , i1 %y ) {
384
384
; CHECK-LABEL: @select_or_same_op(
385
- ; CHECK-NEXT: [[OR:%.*]] = or i1 [[X:%.*]], [[Y:%.*]]
386
- ; CHECK-NEXT: [[R:%.*]] = select i1 [[OR]], i1 [[X]], i1 [[Y]]
387
- ; CHECK-NEXT: ret i1 [[R]]
385
+ ; CHECK-NEXT: ret i1 [[X:%.*]]
388
386
;
389
387
%or = or i1 %x , %y
390
388
%r = select i1 %or , i1 %x , i1 %y
@@ -394,9 +392,7 @@ define i1 @select_or_same_op(i1 %x, i1 %y) {
394
392
395
393
define i1 @select_or_same_op_commute (i1 %x , i1 %y ) {
396
394
; CHECK-LABEL: @select_or_same_op_commute(
397
- ; CHECK-NEXT: [[OR:%.*]] = or i1 [[X:%.*]], [[Y:%.*]]
398
- ; CHECK-NEXT: [[R:%.*]] = select i1 [[OR]], i1 [[Y]], i1 [[X]]
399
- ; CHECK-NEXT: ret i1 [[R]]
395
+ ; CHECK-NEXT: ret i1 [[Y:%.*]]
400
396
;
401
397
%or = or i1 %x , %y
402
398
%r = select i1 %or , i1 %y , i1 %x
@@ -406,9 +402,7 @@ define i1 @select_or_same_op_commute(i1 %x, i1 %y) {
406
402
407
403
define <2 x i1 > @select_or_same_op_vector1 (<2 x i1 > %x , <2 x i1 > %y ) {
408
404
; CHECK-LABEL: @select_or_same_op_vector1(
409
- ; CHECK-NEXT: [[OR:%.*]] = or <2 x i1> [[X:%.*]], [[Y:%.*]]
410
- ; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[OR]], <2 x i1> [[X]], <2 x i1> [[Y]]
411
- ; CHECK-NEXT: ret <2 x i1> [[R]]
405
+ ; CHECK-NEXT: ret <2 x i1> [[X:%.*]]
412
406
;
413
407
%or = or <2 x i1 > %x , %y
414
408
%r = select <2 x i1 > %or , <2 x i1 > %x , <2 x i1 > %y
@@ -418,9 +412,7 @@ define <2 x i1> @select_or_same_op_vector1(<2 x i1> %x, <2 x i1> %y) {
418
412
419
413
define i1 @select_logic_or1_same_op (i1 %x , i1 %y ) {
420
414
; CHECK-LABEL: @select_logic_or1_same_op(
421
- ; CHECK-NEXT: [[OR:%.*]] = select i1 [[X:%.*]], i1 true, i1 [[Y:%.*]]
422
- ; CHECK-NEXT: [[R:%.*]] = select i1 [[OR]], i1 [[X]], i1 [[Y]]
423
- ; CHECK-NEXT: ret i1 [[R]]
415
+ ; CHECK-NEXT: ret i1 [[X:%.*]]
424
416
;
425
417
%or = select i1 %x , i1 true , i1 %y
426
418
%r = select i1 %or , i1 %x , i1 %y
@@ -430,9 +422,7 @@ define i1 @select_logic_or1_same_op(i1 %x, i1 %y) {
430
422
431
423
define i1 @select_logic_or2_same_op (i1 %x , i1 %y ) {
432
424
; CHECK-LABEL: @select_logic_or2_same_op(
433
- ; CHECK-NEXT: [[OR:%.*]] = select i1 [[Y:%.*]], i1 true, i1 [[X:%.*]]
434
- ; CHECK-NEXT: [[R:%.*]] = select i1 [[OR]], i1 [[X]], i1 [[Y]]
435
- ; CHECK-NEXT: ret i1 [[R]]
425
+ ; CHECK-NEXT: ret i1 [[X:%.*]]
436
426
;
437
427
%or = select i1 %y , i1 true , i1 %x
438
428
%r = select i1 %or , i1 %x , i1 %y
@@ -442,15 +432,15 @@ define i1 @select_logic_or2_same_op(i1 %x, i1 %y) {
442
432
443
433
define <2 x i1 > @select_or_same_op_vector2 (<2 x i1 > %x , <2 x i1 > %y ) {
444
434
; CHECK-LABEL: @select_or_same_op_vector2(
445
- ; CHECK-NEXT: [[OR:%.*]] = select <2 x i1> [[X:%.*]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[Y:%.*]]
446
- ; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[OR]], <2 x i1> [[X]], <2 x i1> [[Y]]
447
- ; CHECK-NEXT: ret <2 x i1> [[R]]
435
+ ; CHECK-NEXT: ret <2 x i1> [[X:%.*]]
448
436
;
449
437
%or = select <2 x i1 > %x , <2 x i1 > <i1 true , i1 true >, <2 x i1 > %y
450
438
%r = select <2 x i1 > %or , <2 x i1 > %x , <2 x i1 > %y
451
439
ret <2 x i1 > %r
452
440
}
453
441
442
+ ; TODO: this could transform to X
443
+ ; (X || Y) ? X : Y --> X
454
444
455
445
define <2 x i1 > @select_or_same_op_vector2_poison (<2 x i1 > %x , <2 x i1 > %y ) {
456
446
; CHECK-LABEL: @select_or_same_op_vector2_poison(
0 commit comments