[Unroll] When completely unrolling the loop, replace conditinal branches with uncondi...
authorMichael Zolotukhin <mzolotukhin@apple.com>
Wed, 23 Sep 2015 23:12:43 +0000 (23:12 +0000)
committerMichael Zolotukhin <mzolotukhin@apple.com>
Wed, 23 Sep 2015 23:12:43 +0000 (23:12 +0000)
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

lib/Transforms/Utils/LoopUnroll.cpp

index 971f01b72a16ab46f1104c0ed33f735ce345cbd8..95d31d86644bef1da38ec27d7836db7aecfa0123 100644 (file)
@@ -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;
     }