Skip to content

Commit db40f9b

Browse files
committed
[InstCombine] add test for logical-ands to select; NFC
1 parent 0cf6515 commit db40f9b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/test/Transforms/InstCombine/select-safe-transforms.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,18 @@ define i1 @bools2_logical_commute3(i1 %a, i1 %b, i1 %c) {
546546
ret i1 %or
547547
}
548548

549+
define i1 @bools2_logical_commute3_nopoison(i1 %a, i1 %b, i1 noundef %c) {
550+
; CHECK-LABEL: @bools2_logical_commute3_nopoison(
551+
; CHECK-NEXT: [[OR:%.*]] = select i1 [[C:%.*]], i1 [[A:%.*]], i1 [[B:%.*]]
552+
; CHECK-NEXT: ret i1 [[OR]]
553+
;
554+
%not = xor i1 %c, -1
555+
%and1 = select i1 %a, i1 %c, i1 false
556+
%and2 = select i1 %b, i1 %not, i1 false
557+
%or = select i1 %and1, i1 true, i1 %and2
558+
ret i1 %or
559+
}
560+
549561
define i1 @bools2_logical_commute3_and1(i1 %a, i1 %b, i1 %c) {
550562
; CHECK-LABEL: @bools2_logical_commute3_and1(
551563
; CHECK-NEXT: [[OR:%.*]] = select i1 [[C:%.*]], i1 [[A:%.*]], i1 [[B:%.*]]

0 commit comments

Comments
 (0)