Use opt -S instead of piping bitcode output through llvm-dis.
[oota-llvm.git] / test / Transforms / ScalarRepl / load-store-aggregate.ll
1 ; This testcase shows that scalarrepl is able to replace struct alloca's which
2 ; are directly loaded from or stored to (using the first class aggregates
3 ; feature).
4
5 ; RUN: opt %s -scalarrepl -S > %t
6 ; RUN: cat %t | not grep alloca
7
8 %struct.foo = type { i32, i32 }
9
10 define i32 @test(%struct.foo* %P) {
11 entry:
12         %L = alloca %struct.foo, align 8                ; <%struct.foo*> [#uses=2]
13         %V = load %struct.foo* %P
14         store %struct.foo %V, %struct.foo* %L
15
16         %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0             ; <i32*> [#uses=1]
17         %tmp5 = load i32* %tmp4         ; <i32> [#uses=1]
18         ret i32 %tmp5
19 }
20
21 define %struct.foo @test2(i32 %A, i32 %B) {
22 entry:
23         %L = alloca %struct.foo, align 8                ; <%struct.foo*> [#uses=2]
24         %L.0 = getelementptr %struct.foo* %L, i32 0, i32 0
25         store i32 %A, i32* %L.0
26         %L.1 = getelementptr %struct.foo* %L, i32 0, i32 1
27         store i32 %B, i32* %L.1
28         %V = load %struct.foo* %L
29         ret %struct.foo %V
30 }