Tanya Lattner | dcd188d | 2008-02-14 06:56:27 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\ |
| 2 | ; RUN: llvm-dis | grep {load i32\\* %A} |
Chris Lattner | 465e24b | 2005-03-09 16:29:22 +0000 | [diff] [blame] | 3 | |
Tanya Lattner | dcd188d | 2008-02-14 06:56:27 +0000 | [diff] [blame^] | 4 | declare double* @useit(i32*) |
Chris Lattner | 465e24b | 2005-03-09 16:29:22 +0000 | [diff] [blame] | 5 | |
Tanya Lattner | dcd188d | 2008-02-14 06:56:27 +0000 | [diff] [blame^] | 6 | define i32 @foo(i32 %Amt) { |
| 7 | %A = malloc i32, i32 %Amt |
| 8 | %P = call double* @useit(i32* %A) |
Chris Lattner | 465e24b | 2005-03-09 16:29:22 +0000 | [diff] [blame] | 9 | |
Tanya Lattner | dcd188d | 2008-02-14 06:56:27 +0000 | [diff] [blame^] | 10 | %X = load i32* %A |
Chris Lattner | 465e24b | 2005-03-09 16:29:22 +0000 | [diff] [blame] | 11 | store double 0.0, double* %P |
Tanya Lattner | dcd188d | 2008-02-14 06:56:27 +0000 | [diff] [blame^] | 12 | %Y = load i32* %A |
| 13 | %Z = sub i32 %X, %Y |
| 14 | ret i32 %Z |
Chris Lattner | 465e24b | 2005-03-09 16:29:22 +0000 | [diff] [blame] | 15 | } |