1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 ; <rdar://problem/8606771>
5 define i32 @main(i32 %argc) nounwind ssp {
7 %tmp3151 = trunc i32 %argc to i8
8 %tmp3161 = or i8 %tmp3151, -17
9 %tmp3162 = and i8 %tmp3151, 122
10 %tmp3163 = xor i8 %tmp3162, -17
11 %tmp4114 = shl i8 %tmp3163, 6
12 %tmp4115 = xor i8 %tmp4114, %tmp3163
13 %tmp4120 = xor i8 %tmp3161, %tmp4115
14 ; CHECK: lshr i8 %tmp4115, 1
15 ; CHECK-NOT: shl i8 %tmp4126, 6
16 %tmp4126 = lshr i8 %tmp4120, 7
17 %tmp4127 = mul i8 %tmp4126, 64
18 %tmp4086 = zext i8 %tmp4127 to i32
25 define i8 @foo(i8 %arg, i8 %arg1) nounwind {
28 %tmp2 = and i8 %arg1, 84
29 %tmp3 = and i8 %arg1, -118
30 %tmp4 = and i8 %arg1, 33
31 %tmp5 = sub i8 -88, %tmp2
32 %tmp6 = and i8 %tmp5, 84
33 %tmp7 = or i8 %tmp4, %tmp6
34 %tmp8 = xor i8 %tmp, %tmp3
35 %tmp9 = or i8 %tmp7, %tmp8
36 %tmp10 = lshr i8 %tmp8, 7
37 %tmp11 = shl i8 %tmp10, 5
39 ; CHECK: %0 = lshr i8 %tmp8, 2
40 ; CHECK: %tmp11 = and i8 %0, 32
42 %tmp12 = xor i8 %tmp11, %tmp9