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
5 ; RUN: opt < %s -scalarrepl -S > %t
6 ; RUN: cat %t | not grep alloca
8 %struct.foo = type { i32, i32 }
10 define i32 @test(%struct.foo* %P) {
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
16 %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1]
17 %tmp5 = load i32* %tmp4 ; <i32> [#uses=1]
21 define %struct.foo @test2(i32 %A, i32 %B) {
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