1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 ; %cmp should not vanish
5 define i1 @f(i32 %i1) {
8 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I1:%.*]], 0
9 ; CHECK-NEXT: [[SHR:%.*]] = lshr i32 7, [[I1]]
10 ; CHECK-NEXT: [[CMP4:%.*]] = icmp slt i32 [[SHR]], [[I1]]
11 ; CHECK-NEXT: [[I2:%.*]] = select i1 [[CMP]], i1 true, i1 [[CMP4]]
12 ; CHECK-NEXT: ret i1 [[I2]]
15 %cmp = icmp slt i32 %i1, 0
16 %shr = ashr i32 7, %i1
17 %cmp4 = icmp sgt i32 %i1, %shr
18 %i2 = select i1 %cmp, i1 true, i1 %cmp4
22 ; %cmp should not vanish
23 define i32 @f2(i32 signext %g, i32 zeroext %h) {
25 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[G:%.*]], 0
26 ; CHECK-NEXT: [[SHR:%.*]] = lshr i32 7, [[H:%.*]]
27 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[SHR]], [[G]]
28 ; CHECK-NEXT: [[DOT0:%.*]] = select i1 [[CMP]], i1 true, i1 [[CMP1]]
29 ; CHECK-NEXT: [[LOR_EXT:%.*]] = zext i1 [[DOT0]] to i32
30 ; CHECK-NEXT: ret i32 [[LOR_EXT]]
32 %cmp = icmp slt i32 %g, 0
34 %cmp1 = icmp sgt i32 %g, %shr
35 %.0 = select i1 %cmp, i1 true, i1 %cmp1
36 %lor.ext = zext i1 %.0 to i32