1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -instcombine -o - -S %s | FileCheck %s
4 ; The constant at %v35 should be shrunk, but this must lead to the nsw flag of
5 ; %v43 getting removed.
7 define i32 @foo(i32 %arg) {
9 ; CHECK-NEXT: [[V33:%.*]] = and i32 [[ARG:%.*]], 223
10 ; CHECK-NEXT: [[V34:%.*]] = xor i32 [[V33]], 29
11 ; CHECK-NEXT: [[V35:%.*]] = add nuw nsw i32 [[V34]], 1362915575
12 ; CHECK-NEXT: [[V40:%.*]] = shl nuw nsw i32 [[V34]], 1
13 ; CHECK-NEXT: [[V41:%.*]] = and i32 [[V40]], 290
14 ; CHECK-NEXT: [[V42:%.*]] = sub nuw nsw i32 [[V35]], [[V41]]
15 ; CHECK-NEXT: [[V43:%.*]] = add nuw i32 [[V42]], 1533579450
16 ; CHECK-NEXT: [[V45:%.*]] = xor i32 [[V43]], 749011377
17 ; CHECK-NEXT: ret i32 [[V45]]
19 %v33 = and i32 %arg, 223
20 %v34 = xor i32 %v33, 29
21 %v35 = add nuw i32 %v34, 3510399223
22 %v37 = or i32 %v34, 1874836915
23 %v38 = and i32 %v34, 221
24 %v39 = xor i32 %v38, 1874836915
25 %v40 = xor i32 %v37, %v39
26 %v41 = shl nsw nuw i32 %v40, 1
27 %v42 = sub i32 %v35, %v41
28 %v43 = add nsw i32 %v42, 1533579450
29 %v44 = or i32 %v43, -2147483648
30 %v45 = xor i32 %v44, 749011377