1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 ; PR49778: this should not be folded to 0.
5 define i32 @src(i1 %x2) {
7 ; CHECK-NEXT: [[X13:%.*]] = zext i1 [[X2:%.*]] to i32
8 ; CHECK-NEXT: [[_7:%.*]] = shl nsw i32 -1, [[X13]]
9 ; CHECK-NEXT: [[MASK:%.*]] = xor i32 [[_7]], -1
10 ; CHECK-NEXT: [[_8:%.*]] = and i32 [[MASK]], [[X13]]
11 ; CHECK-NEXT: [[_9:%.*]] = shl nuw nsw i32 [[_8]], [[X13]]
12 ; CHECK-NEXT: ret i32 [[_9]]
14 %x13 = zext i1 %x2 to i32
15 %_7 = shl i32 4294967295, %x13
16 %mask = xor i32 %_7, 4294967295
17 %_8 = and i32 %mask, %x13
18 %_9 = shl i32 %_8, %x13