Chris Lattner | 71c7534 | 2009-01-07 08:11:13 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca |
| 2 | ; PR3290 |
| 3 | |
| 4 | ;; Store of integer to whole alloca struct. |
| 5 | define i32 @test1(i64 %V) nounwind { |
| 6 | %X = alloca {{i32, i32}} |
| 7 | %Y = bitcast {{i32,i32}}* %X to i64* |
| 8 | store i64 %V, i64* %Y |
| 9 | |
| 10 | %A = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 0 |
| 11 | %B = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 1 |
| 12 | %a = load i32* %A |
| 13 | %b = load i32* %B |
| 14 | %c = add i32 %a, %b |
| 15 | ret i32 %c |
| 16 | } |
| 17 | |
| 18 | ;; Store of integer to whole struct/array alloca. |
| 19 | define float @test2(i128 %V) nounwind { |
| 20 | %X = alloca {[4 x float]} |
| 21 | %Y = bitcast {[4 x float]}* %X to i128* |
| 22 | store i128 %V, i128* %Y |
| 23 | |
| 24 | %A = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 0 |
| 25 | %B = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 3 |
| 26 | %a = load float* %A |
| 27 | %b = load float* %B |
| 28 | %c = add float %a, %b |
| 29 | ret float %c |
| 30 | } |
| 31 | |