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
4 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
6 ; RUN: opt < %s -scalarrepl -S > %t
7 ; RUN: cat %t | not grep alloca
9 %struct.foo = type { i32, i32 }
11 define i32 @test(%struct.foo* %P) {
13 %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
14 %V = load %struct.foo* %P
15 store %struct.foo %V, %struct.foo* %L
17 %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1]
18 %tmp5 = load i32* %tmp4 ; <i32> [#uses=1]
22 define %struct.foo @test2(i32 %A, i32 %B) {
24 %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2]
25 %L.0 = getelementptr %struct.foo* %L, i32 0, i32 0
26 store i32 %A, i32* %L.0
27 %L.1 = getelementptr %struct.foo* %L, i32 0, i32 1
28 store i32 %B, i32* %L.1
29 %V = load %struct.foo* %L