Use opt -S instead of piping bitcode output through llvm-dis.
[oota-llvm.git] / test / Transforms / ScalarRepl / copy-aggregate.ll
1 ; RUN: opt %s -scalarrepl -S | 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 = fadd float %a, %b
29         ret float %c
30 }
31
32 ;; Load of whole alloca struct as integer
33 define i64 @test3(i32 %a, i32 %b) nounwind {
34         %X = alloca {{i32, i32}}
35
36         %A = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 0
37         %B = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 1
38         store i32 %a, i32* %A
39         store i32 %b, i32* %B
40
41         %Y = bitcast {{i32,i32}}* %X to i64*
42         %Z = load i64* %Y
43         ret i64 %Z
44 }
45
46 ;; load of integer from whole struct/array alloca.
47 define i128 @test4(float %a, float %b) nounwind {
48         %X = alloca {[4 x float]}
49         %A = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 0
50         %B = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 3
51         store float %a, float* %A
52         store float %b, float* %B
53         
54         %Y = bitcast {[4 x float]}* %X to i128*
55         %V = load i128* %Y
56         ret i128 %V
57 }