aboutsummaryrefslogtreecommitdiffstats
path: root/test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll
blob: 692c6f8693abf6957197fdb18d4b7350ad85c55b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | \
; RUN:    llvm-dis | not grep load

@X = constant [2 x i32] [i32 4, i32 5]

define i32 @test(i32* %Y, i64 %idx) {
    %P = getelementptr [2 x i32]* @X, i64 0, i64 %idx
	%A = load i32* %P      ; Load from invariant memory
	store i32 4, i32* %Y   ; Store could not be to @X
	%B = load i32* %P
	%C = sub i32 %A, %B
	ret i32 %C
}