blob: cb2b27eeb2243fd82ff7893f4540eca43fe8f016 [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
Reid Spencerd0e30dc2006-12-02 04:23:10 +00005; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
Chris Lattner22a8d512003-02-26 21:39:52 +00006
7int %test() {
8 %A = alloca int
9 store int 0, int* %A
10 %X = load int* %A
11 %B = cast int* %A to sbyte*
12 %C = getelementptr sbyte* %B, long 1
13 store sbyte 1, sbyte* %C ; Aliases %A
14 %Y.DONOTREMOVE = load int* %A
15 %Z = sub int %X, %Y.DONOTREMOVE
16 ret int %Z
17}
18