Trim testcase a bit
[oota-llvm.git] / test / Analysis / BasicAA / gcsetest.ll
1 ; Test that GCSE uses basicaa to do alias analysis, which is capable of 
2 ; disambiguating some obvious cases.  All loads should be removable in 
3 ; this testcase.
4
5 ; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep load
6 ; RUN: then exit 1
7 ; RUN: else exit 0
8 ; RUN: fi
9
10 %A = global int 7
11 %B = global int 8
12 implementation
13
14 int %test() {
15         %A1 = load int* %A
16
17         store int 123, int* %B  ; Store cannot alias %A
18
19         %A2 = load int* %A
20         %X = sub int %A1, %A2
21         ret int %X
22 }
23
24 int %test2() {
25         %A1 = load int* %A
26         br label %Loop
27 Loop:
28         %AP = phi int [0, %0], [%X, %Loop]
29         store int %AP, int* %B  ; Store cannot alias %A
30
31         %A2 = load int* %A
32         %X = sub int %A1, %A2
33         %c = seteq int %X, 0
34         br bool %c, label %out, label %Loop
35
36 out:
37         ret int %X
38 }
39