blob: 4a3239fa56dca61d6b8f3f50be4d122c8198022b [file] [log] [blame]
Chris Lattner22a8d512003-02-26 21:39:52 +00001; This testcase makes sure that size is taken to account when alias analysis
2; is performed. It is not legal to delete the second load instruction because
3; the value computed by the first load instruction is changed by the store.
4
Tanya Lattnerf865dcd2008-02-14 06:56:27 +00005; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
Chris Lattner22a8d512003-02-26 21:39:52 +00006
Tanya Lattnerf865dcd2008-02-14 06:56:27 +00007define i32 @test() {
8 %A = alloca i32
9 store i32 0, i32* %A
10 %X = load i32* %A
11 %B = bitcast i32* %A to i8*
12 %C = getelementptr i8* %B, i64 1
13 store i8 1, i8* %C ; Aliases %A
14 %Y.DONOTREMOVE = load i32* %A
15 %Z = sub i32 %X, %Y.DONOTREMOVE
16 ret i32 %Z
Chris Lattner22a8d512003-02-26 21:39:52 +000017}
18