diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-02 20:24:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-02 20:24:21 +0000 |
commit | 8e08e73f0e12c9e669f2d7d0a5c9213df3046c01 (patch) | |
tree | 298c8885cb38e4ab8aaba9ee935f716e78887f89 /test/Transforms/LoopIdiom | |
parent | 80220369b040dd9769e4c4b65d2d018210c3b240 (diff) |
If a loop iterates exactly once (has backedge count = 0) then don't
mess with it. We'd rather peel/unroll it than convert all of its
stores into memsets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122711 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom')
-rw-r--r-- | test/Transforms/LoopIdiom/basic.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll index 3fa6eb900b..e8e0f38004 100644 --- a/test/Transforms/LoopIdiom/basic.ll +++ b/test/Transforms/LoopIdiom/basic.ll @@ -188,4 +188,22 @@ for.end: ; preds = %for.body, %entry ; CHECK-NOT: store } +; This is a loop should not be transformed, it only executes one iteration. +define void @test8(i64* %Ptr, 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 ] + %PI = getelementptr i64* %Ptr, i64 %indvar + store i64 0, i64 *%PI + %indvar.next = add i64 %indvar, 1 + %exitcond = icmp eq i64 %indvar.next, 1 + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body, %entry + ret void +; CHECK: @test8 +; CHECK: store i64 0, i64* %PI +} |