diff options
author | Chris Lattner <sabre@nondot.org> | 2007-03-19 00:09:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-03-19 00:09:00 +0000 |
commit | 7829828c4bf819429ad4ccb9df4a0fb0f88ef049 (patch) | |
tree | 8a7dfb55ad31c0f6cbeffaea435362f3c473394f /test/Transforms/ScalarRepl/memset-aggregate.ll | |
parent | 3f64b1ab1d580e17e90367ce3916061e9a11392e (diff) | |
download | llvm-7829828c4bf819429ad4ccb9df4a0fb0f88ef049.tar.gz llvm-7829828c4bf819429ad4ccb9df4a0fb0f88ef049.tar.bz2 llvm-7829828c4bf819429ad4ccb9df4a0fb0f88ef049.tar.xz |
testcase for SROA with memset etc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ScalarRepl/memset-aggregate.ll')
-rw-r--r-- | test/Transforms/ScalarRepl/memset-aggregate.ll | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/Transforms/ScalarRepl/memset-aggregate.ll b/test/Transforms/ScalarRepl/memset-aggregate.ll new file mode 100644 index 0000000000..3c5b6627bd --- /dev/null +++ b/test/Transforms/ScalarRepl/memset-aggregate.ll @@ -0,0 +1,48 @@ +; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep 'ret i32 16843009' +; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" +target triple = "i686-apple-darwin8" + %struct.bar = type { %struct.foo, i64, double } + %struct.foo = type { i32, i32 } + +implementation ; Functions: + +define i32 @test1(%struct.foo* %P) { +entry: + %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] + %L2 = bitcast %struct.foo* %L to i8* ; <i8*> [#uses=1] + %tmp13 = bitcast %struct.foo* %P to i8* ; <i8*> [#uses=1] + call void @llvm.memcpy.i32( i8* %L2, i8* %tmp13, i32 8, i32 4 ) + %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1] + %tmp5 = load i32* %tmp4 ; <i32> [#uses=1] + ret i32 %tmp5 +} + +declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) + +define i32 @test2() { +entry: + %L = alloca [4 x %struct.foo], align 16 ; <[4 x %struct.foo]*> [#uses=2] + %L12 = bitcast [4 x %struct.foo]* %L to i8* ; <i8*> [#uses=1] + call void @llvm.memset.i32( i8* %L12, i8 0, i32 32, i32 16 ) + %tmp4 = getelementptr [4 x %struct.foo]* %L, i32 0, i32 0, i32 0 ; <i32*> [#uses=1] + %tmp5 = load i32* %tmp4 ; <i32> [#uses=1] + ret i32 %tmp5 +} + +declare void @llvm.memset.i32(i8*, i8, i32, i32) + +define i32 @test3() { +entry: + %B = alloca %struct.bar, align 16 ; <%struct.bar*> [#uses=4] + %B1 = bitcast %struct.bar* %B to i8* ; <i8*> [#uses=1] + call void @llvm.memset.i32( i8* %B1, i8 1, i32 24, i32 16 ) + %tmp3 = getelementptr %struct.bar* %B, i32 0, i32 0, i32 0 ; <i32*> [#uses=1] + store i32 1, i32* %tmp3 + %tmp4 = getelementptr %struct.bar* %B, i32 0, i32 2 ; <double*> [#uses=1] + store double 1.000000e+01, double* %tmp4 + %tmp6 = getelementptr %struct.bar* %B, i32 0, i32 0, i32 1 ; <i32*> [#uses=1] + %tmp7 = load i32* %tmp6 ; <i32> [#uses=1] + ret i32 %tmp7 +} |