For PR1319:
[oota-llvm.git] / test / Analysis / GlobalsModRef / indirect-global.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | \
2 ; RUN:   opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
3 ; RUN:   grep {ret i32 0}
4 ; END.
5 %G = internal global int* null
6
7 implementation
8
9 void %test() {
10         %A = malloc int
11         store int* %A, int** %G
12         ret void
13 }
14
15 int %test1(int *%P) {
16         %g1 = load int** %G
17         %h1 = load int* %g1
18
19         ; This store cannot alias either G or g1.
20         store int 123, int* %P
21
22         %g2 = load int** %G
23         %h2 = load int* %g1
24         %X = sub int %h1, %h2   ;; -> 0
25         ret int %X
26 }