From: Michael Zolotukhin <mzolotukhin@apple.com>
Date: Wed, 23 Sep 2015 23:12:43 +0000 (+0000)
Subject: [Unroll] When completely unrolling the loop, replace conditinal branches with uncondi... 
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=90ef438f244ea9fdba63284b910e771b9d0192ad;p=oota-llvm.git

[Unroll] When completely unrolling the loop, replace conditinal branches with unconditional.

Nothing is expected to change, except we do less redundant work in
clean-up.

Reviewers: hfinkel

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12951

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248444 91177308-0d34-0410-b5e6-96231b3b80d8
---

diff --git a/lib/Transforms/Utils/LoopUnroll.cpp b/lib/Transforms/Utils/LoopUnroll.cpp
index 971f01b72a1..95d31d86644 100644
--- a/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/lib/Transforms/Utils/LoopUnroll.cpp
@@ -434,8 +434,9 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
 
     // For a complete unroll, make the last iteration end with a branch
     // to the exit block.
-    if (CompletelyUnroll && j == 0) {
-      Dest = LoopExit;
+    if (CompletelyUnroll) {
+      if (j == 0)
+        Dest = LoopExit;
       NeedConditional = false;
     }