1; RUN: opt -instcombine -o - -S %s | FileCheck %s
2
3; The constant at %v35 should be shrunk, but this must lead to the nsw flag of
4; %v43 getting removed so that %v44 is not illegally optimized away.
5; CHECK-LABEL: @foo
6; CHECK: %v35 = add nuw i32 %v34, 1362915575
7; ...
8; CHECK: add nuw i32 %v42, 1533579450
9; CHECK-NEXT: %v44 = or i32 %v43, -2147483648
10; CHECK-NEXT: %v45 = xor i32 %v44, 749011377
11; CHECK-NEXT: ret i32 %v45
12define i32 @foo(i32 %arg) {
13  %v33 = and i32 %arg, 223
14  %v34 = xor i32 %v33, 29
15  %v35 = add nuw i32 %v34, 3510399223
16  %v37 = or i32 %v34, 1874836915
17  %v38 = and i32 %v34, 221
18  %v39 = xor i32 %v38, 1874836915
19  %v40 = xor i32 %v37, %v39
20  %v41 = shl nsw nuw i32 %v40, 1
21  %v42 = sub i32 %v35, %v41
22  %v43 = add nsw i32 %v42, 1533579450
23  %v44 = or i32 %v43, -2147483648
24  %v45 = xor i32 %v44, 749011377
25  ret i32 %v45
26}
27