blob: c3685d0930771cc0d9c38b65bb04489b21cf3308 [file] [log] [blame]
Chris Lattner71c75342009-01-07 08:11:13 +00001; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
2; PR3290
3
4;; Store of integer to whole alloca struct.
5define 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.
19define 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