| Chris Lattner | 22a8d51 | 2003-02-26 21:39:52 +0000 | [diff] [blame] | 1 | ; 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 Spencer | d0e30dc | 2006-12-02 04:23:10 +0000 | [diff] [blame] | 5 | ; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE | 
| Chris Lattner | 22a8d51 | 2003-02-26 21:39:52 +0000 | [diff] [blame] | 6 |  | 
|  | 7 | int %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 |  |