summaryrefslogtreecommitdiff
path: root/test/Analysis/GlobalsModRef/indirect-global.ll
blob: bb75732bebb0826c61e7ec3330fb4de4ec670f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
; RUN: llvm-upgrade < %s | llvm-as | \
; RUN:   opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
; RUN:   grep 'ret i32 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
}