Home | History | Annotate | Download | only in InstCombine
      1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
      2 ;RUN: opt -instcombine -S %s | FileCheck %s
      3 
      4 ; We shouldn't remove the select before the srem
      5 define i32 @foo(i1 %a, i32 %b, i32 %c) {
      6 ; CHECK-LABEL: @foo(
      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]]
     11 ;
     12   %sel1 = select i1 %a, i32 %b, i32 -1
     13   %rem = srem i32 %c, %sel1
     14   %sel2 = select i1 %a, i32 %rem, i32 0
     15   ret i32 %sel2
     16 }
     17 
     18