For PR950:
[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 %G = internal global int* null
5
6 implementation
7
8 void %test() {
9         %A = malloc int
10         store int* %A, int** %G
11         ret void
12 }
13
14 int %test1(int *%P) {
15         %g1 = load int** %G
16         %h1 = load int* %g1
17
18         ; This store cannot alias either G or g1.
19         store int 123, int* %P
20
21         %g2 = load int** %G
22         %h2 = load int* %g1
23         %X = sub int %h1, %h2   ;; -> 0
24         ret int %X
25 }