diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-03-22 05:37:16 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-03-22 05:37:16 +0000 |
| commit | 60b9cb4080a1faf9ac56b19005b86130d1590ca7 (patch) | |
| tree | 18acc6a6e983aaeeb5e3e1d80b59e62b045a2b5e /test | |
| parent | 1be832267a50570c9c05789aeb72f93b3f76b021 (diff) | |
| download | external_llvm-60b9cb4080a1faf9ac56b19005b86130d1590ca7.zip external_llvm-60b9cb4080a1faf9ac56b19005b86130d1590ca7.tar.gz external_llvm-60b9cb4080a1faf9ac56b19005b86130d1590ca7.tar.bz2 | |
implement an initial hack at a straight-line store -> memset optimization.
This fires dozens of times across spec and multisource, but I don't know
if it actually speeds stuff up. Hopefully the testers will show something
nice :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
| -rw-r--r-- | test/Transforms/GVN/form-memset.ll | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/Transforms/GVN/form-memset.ll b/test/Transforms/GVN/form-memset.ll new file mode 100644 index 0000000..a026cde --- /dev/null +++ b/test/Transforms/GVN/form-memset.ll @@ -0,0 +1,55 @@ +; RUN: llvm-as < %s | opt -gvn | llvm-dis | not grep store +; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep llvm.memset + +; All the stores in this example should be merged into a single memset. + +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-f80:128:128" +target triple = "i386-apple-darwin8" + +define void @foo(i8 signext %c) nounwind { +entry: + %x = alloca [19 x i8] ; <[19 x i8]*> [#uses=20] + %tmp = getelementptr [19 x i8]* %x, i32 0, i32 0 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp, align 1 + %tmp5 = getelementptr [19 x i8]* %x, i32 0, i32 1 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp5, align 1 + %tmp9 = getelementptr [19 x i8]* %x, i32 0, i32 2 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp9, align 1 + %tmp13 = getelementptr [19 x i8]* %x, i32 0, i32 3 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp13, align 1 + %tmp17 = getelementptr [19 x i8]* %x, i32 0, i32 4 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp17, align 1 + %tmp21 = getelementptr [19 x i8]* %x, i32 0, i32 5 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp21, align 1 + %tmp25 = getelementptr [19 x i8]* %x, i32 0, i32 6 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp25, align 1 + %tmp29 = getelementptr [19 x i8]* %x, i32 0, i32 7 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp29, align 1 + %tmp33 = getelementptr [19 x i8]* %x, i32 0, i32 8 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp33, align 1 + %tmp37 = getelementptr [19 x i8]* %x, i32 0, i32 9 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp37, align 1 + %tmp41 = getelementptr [19 x i8]* %x, i32 0, i32 10 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp41, align 1 + %tmp45 = getelementptr [19 x i8]* %x, i32 0, i32 11 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp45, align 1 + %tmp49 = getelementptr [19 x i8]* %x, i32 0, i32 12 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp49, align 1 + %tmp53 = getelementptr [19 x i8]* %x, i32 0, i32 13 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp53, align 1 + %tmp57 = getelementptr [19 x i8]* %x, i32 0, i32 14 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp57, align 1 + %tmp61 = getelementptr [19 x i8]* %x, i32 0, i32 15 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp61, align 1 + %tmp65 = getelementptr [19 x i8]* %x, i32 0, i32 16 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp65, align 1 + %tmp69 = getelementptr [19 x i8]* %x, i32 0, i32 17 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp69, align 1 + %tmp73 = getelementptr [19 x i8]* %x, i32 0, i32 18 ; <i8*> [#uses=1] + store i8 %c, i8* %tmp73, align 1 + %tmp76 = call i32 (...)* @bar( [19 x i8]* %x ) nounwind ; <i32> [#uses=0] + ret void +} + +declare i32 @bar(...) + |
