aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/LoopIdiom
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-02 03:37:56 +0000
committerChris Lattner <sabre@nondot.org>2011-01-02 03:37:56 +0000
commite2c43920919c6fe376613d1d8331897dc1ba3d57 (patch)
treea888fc1f2bd27d531ecb90121b6366377206960e /test/Transforms/LoopIdiom
parentabd6c754090b1ff13b0dee925989bf8676d9cb4c (diff)
teach loop idiom recognition to form memcpy's from simple loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom')
-rw-r--r--test/Transforms/LoopIdiom/basic.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll
index ee93cb3262..8929fe4801 100644
--- a/test/Transforms/LoopIdiom/basic.ll
+++ b/test/Transforms/LoopIdiom/basic.ll
@@ -114,3 +114,31 @@ for.end: ; preds = %for.body, %entry
; CHECK: ret void
}
+
+;; memcpy formation
+define void @test6(i64 %Size) nounwind ssp {
+bb.nph:
+ %Base = alloca i8, i32 10000
+ %Dest = alloca i8, i32 10000
+ br label %for.body
+
+for.body: ; preds = %bb.nph, %for.body
+ %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body ]
+ %I.0.014 = getelementptr i8* %Base, i64 %indvar
+ %DestI = getelementptr i8* %Dest, i64 %indvar
+ %V = load i8* %I.0.014, align 1
+ store i8 %V, i8* %DestI, align 1
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, %Size
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body, %entry
+ ret void
+; CHECK: @test6
+; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %Dest, i8* %Base, i64 %Size, i32 1, i1 false)
+; CHECK-NOT: store
+; CHECK: ret void
+}
+
+
+