blob: a49f3130bb03e77d024cc1ace0570e1d50facccf [file] [log] [blame]
Chris Lattnerac39b4e2002-08-22 17:31:36 +00001; 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 -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
12implementation
13
14int %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
Chris Lattner8673e442002-08-22 20:22:55 +000024int %test2() {
25 %A1 = load int* %A
26 br label %Loop
27Loop:
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
36out:
37 ret int %X
38}
39