llvm-6502/test/Analysis/GlobalsModRef/indirect-global.ll
2006-12-02 04:23:10 +00:00

24 lines
457 B
LLVM

; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | grep 'ret int 0'
%G = internal global int* null
implementation
void %test() {
%A = malloc int
store int* %A, int** %G
ret void
}
int %test1(int *%P) {
%g1 = load int** %G
%h1 = load int* %g1
; This store cannot alias either G or g1.
store int 123, int* %P
%g2 = load int** %G
%h2 = load int* %g1
%X = sub int %h1, %h2 ;; -> 0
ret int %X
}