aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/LoopIdiom/basic.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-02 19:01:03 +0000
committerChris Lattner <sabre@nondot.org>2011-01-02 19:01:03 +0000
commit62c50fdf69064c0d086aedfadb6ceb7c303bbcb9 (patch)
tree5b9b4f6e248ecf48441915887b6977c429129db9 /test/Transforms/LoopIdiom/basic.ll
parent81a866d615d6e4ee8dcbd49268d2cfb174f5155b (diff)
downloadexternal_llvm-62c50fdf69064c0d086aedfadb6ceb7c303bbcb9.zip
external_llvm-62c50fdf69064c0d086aedfadb6ceb7c303bbcb9.tar.gz
external_llvm-62c50fdf69064c0d086aedfadb6ceb7c303bbcb9.tar.bz2
enhance loop idiom recognition to scan *all* unconditionally executed
blocks in a loop, instead of just the header block. This makes it more aggressive, able to handle Duncan's Ada examples. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom/basic.ll')
-rw-r--r--test/Transforms/LoopIdiom/basic.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll
index 589fea4..3fa6eb9 100644
--- a/test/Transforms/LoopIdiom/basic.ll
+++ b/test/Transforms/LoopIdiom/basic.ll
@@ -165,4 +165,27 @@ for.end: ; preds = %for.body, %entry
}
+; This is a loop that was rotated but where the blocks weren't merged. This
+; shouldn't perturb us.
+define void @test7(i8* %Base, i64 %Size) nounwind ssp {
+bb.nph: ; preds = %entry
+ br label %for.body
+
+for.body: ; preds = %bb.nph, %for.body
+ %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body.cont ]
+ br label %for.body.cont
+for.body.cont:
+ %I.0.014 = getelementptr i8* %Base, i64 %indvar
+ store i8 0, i8* %I.0.014, 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: @test7
+; CHECK: call void @llvm.memset.p0i8.i64(i8* %Base, i8 0, i64 %Size, i32 1, i1 false)
+; CHECK-NOT: store
+}
+