Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
[oota-llvm.git] / test / Transforms / InstCombine / bit-tracking.ll
1 ; This file contains various testcases that require tracking whether bits are
2 ; set or cleared by various instructions.
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -instcombine | llvm-dis |\
4 ; RUN:   not grep %ELIM
5
6 ; Reduce down to a single XOR
7 int %test3(int %B) {
8         %ELIMinc = and int %B, 1
9         %tmp.5 = xor int %ELIMinc, 1
10         %ELIM7 = and int %B, -2
11         %tmp.8 = or int %tmp.5, %ELIM7
12         ret int %tmp.8
13 }
14
15 ; Finally, a bigger case where we chain things together.  This corresponds to
16 ; incrementing a single-bit bitfield, which should become just an xor.
17 int %test4(int %B) {
18         %ELIM3 = shl int %B, ubyte 31
19         %ELIM4 = shr int %ELIM3, ubyte 31
20         %inc = add int %ELIM4, 1
21         %ELIM5 = and int %inc, 1
22         %ELIM7 = and int %B, -2
23         %tmp.8 = or int %ELIM5, %ELIM7
24         ret int %tmp.8
25 }
26