1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ;RUN: opt -instcombine -S %s | FileCheck %s
4 ; We shouldn't remove the select before the srem
5 define i32 @foo(i1 %a, i32 %b, i32 %c) {
7 ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[A:%.*]], i32 [[B:%.*]], i32 -1
8 ; CHECK-NEXT: [[REM:%.*]] = srem i32 [[C:%.*]], [[SEL1]]
9 ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[A]], i32 [[REM]], i32 0
10 ; CHECK-NEXT: ret i32 [[SEL2]]
12 %sel1 = select i1 %a, i32 %b, i32 -1
13 %rem = srem i32 %c, %sel1
14 %sel2 = select i1 %a, i32 %rem, i32 0