Reid Spencer | eacb702 | 2006-12-31 06:02:00 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | \ |
| 2 | ; RUN: opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \ |
| 3 | ; RUN: grep 'ret i32 0' |
Chris Lattner | b363312 | 2006-10-01 22:35:45 +0000 | [diff] [blame] | 4 | %G = internal global int* null |
| 5 | |
| 6 | implementation |
| 7 | |
| 8 | void %test() { |
| 9 | %A = malloc int |
| 10 | store int* %A, int** %G |
| 11 | ret void |
| 12 | } |
| 13 | |
| 14 | int %test1(int *%P) { |
| 15 | %g1 = load int** %G |
| 16 | %h1 = load int* %g1 |
| 17 | |
| 18 | ; This store cannot alias either G or g1. |
| 19 | store int 123, int* %P |
| 20 | |
| 21 | %g2 = load int** %G |
| 22 | %h2 = load int* %g1 |
| 23 | %X = sub int %h1, %h2 ;; -> 0 |
| 24 | ret int %X |
| 25 | } |