[InstCombine] add test with swapped select operands; NFC

More coverage for the proposal in D65576.

llvm-svn: 367577
This commit is contained in:
Sanjay Patel 2019-08-01 15:32:10 +00:00
parent 01dcdcdd92
commit 350b389c90
1 changed files with 13 additions and 0 deletions

View File

@ -1329,6 +1329,19 @@ define i32 @PR23757(i32 %x) {
ret i32 %sel
}
define i32 @PR23757_swapped(i32 %x) {
; CHECK-LABEL: @PR23757_swapped(
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[X:%.*]], 2147483647
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[X]], 1
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP]], i32 [[ADD]], i32 -2147483648
; CHECK-NEXT: ret i32 [[SEL]]
;
%cmp = icmp eq i32 %x, 2147483647
%add = add nsw i32 %x, 1
%sel = select i1 %cmp, i32 %add, i32 -2147483648
ret i32 %sel
}
; max(max(~a, -1), -1) --> ~min(a, 0)
define i32 @PR27137(i32 %a) {