Mercurial > hg > CbC > CbC_llvm
comparison test/Transforms/ScalarRepl/load-store-aggregate.ll @ 0:95c75e76d11b LLVM3.4
LLVM 3.4
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 12 Dec 2013 13:56:28 +0900 |
parents | |
children | afa8332a0e37 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:95c75e76d11b |
---|---|
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 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" | |
5 | |
6 ; RUN: opt < %s -scalarrepl -S > %t | |
7 ; RUN: cat %t | not grep alloca | |
8 | |
9 %struct.foo = type { i32, i32 } | |
10 | |
11 define i32 @test(%struct.foo* %P) { | |
12 entry: | |
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 | |
16 | |
17 %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1] | |
18 %tmp5 = load i32* %tmp4 ; <i32> [#uses=1] | |
19 ret i32 %tmp5 | |
20 } | |
21 | |
22 define %struct.foo @test2(i32 %A, i32 %B) { | |
23 entry: | |
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 | |
30 ret %struct.foo %V | |
31 } |