From e2c43920919c6fe376613d1d8331897dc1ba3d57 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 2 Jan 2011 03:37:56 +0000 Subject: 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 --- test/Transforms/LoopIdiom/basic.ll | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/Transforms/LoopIdiom') 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 +} + + + -- cgit v1.2.3-18-g5258