llvm.org GIT mirror llvm / f088720
filecheckize git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93775 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
1 changed file(s) with 19 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
None ; RUN: opt < %s -reassociate -dce -S | \
1 ; RUN: not grep {\\(and\\|sub\\)}
0 ; RUN: opt < %s -reassociate -die -S | FileCheck %s
21
32 define i32 @test1(i32 %a, i32 %b) {
4 %tmp.2 = and i32 %b, %a ; [#uses=1]
5 %tmp.4 = xor i32 %a, -1 ; [#uses=1]
3 %tmp.2 = and i32 %b, %a
4 %tmp.4 = xor i32 %a, -1
65 ; (A&B)&~A == 0
7 %tmp.5 = and i32 %tmp.2, %tmp.4 ; [#uses=1]
6 %tmp.5 = and i32 %tmp.2, %tmp.4
87 ret i32 %tmp.5
8 ; CHECK: @test1
9 ; CHECK: ret i32 0
910 }
1011
1112 define i32 @test2(i32 %a, i32 %b) {
12 %tmp.1 = and i32 %a, 1234 ; [#uses=1]
13 %tmp.2 = and i32 %b, %tmp.1 ; [#uses=1]
14 %tmp.4 = xor i32 %a, -1 ; [#uses=1]
13 %tmp.1 = and i32 %a, 1234
14 %tmp.2 = and i32 %b, %tmp.1
15 %tmp.4 = xor i32 %a, -1
1516 ; A&~A == 0
16 %tmp.5 = and i32 %tmp.2, %tmp.4 ; [#uses=1]
17 %tmp.5 = and i32 %tmp.2, %tmp.4
1718 ret i32 %tmp.5
19 ; CHECK: @test2
20 ; CHECK: ret i32 0
1821 }
1922
2023 define i32 @test3(i32 %b, i32 %a) {
21 %tmp.1 = add i32 %a, 1234 ; [#uses=1]
22 %tmp.2 = add i32 %b, %tmp.1 ; [#uses=1]
23 %tmp.4 = sub i32 0, %a ; [#uses=1]
24 %tmp.1 = add i32 %a, 1234
25 %tmp.2 = add i32 %b, %tmp.1
26 %tmp.4 = sub i32 0, %a
2427 ; (b+(a+1234))+-a -> b+1234
25 %tmp.5 = add i32 %tmp.2, %tmp.4 ; [#uses=1]
28 %tmp.5 = add i32 %tmp.2, %tmp.4
2629 ret i32 %tmp.5
30 ; CHECK: @test3
31 ; CHECK: %tmp.5 = add i32 %b, 1234
32 ; CHECK: ret i32 %tmp.5
2733 }