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

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 16:05:09 PDT 2015


mzolotukhin created this revision.
mzolotukhin added a reviewer: hfinkel.
mzolotukhin added a subscriber: llvm-commits.

I see no reasons why we don't do this at the moment (or I'm misreading
the code). Later clean-ups replace conditional branches anyway, but
that's unnecessary work. It might be even more relevant if we unroll
loops with relatively high trip-count.

Does this patch make sense?

http://reviews.llvm.org/D12951

Files:
  lib/Transforms/Utils/LoopUnroll.cpp

Index: lib/Transforms/Utils/LoopUnroll.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnroll.cpp
+++ lib/Transforms/Utils/LoopUnroll.cpp
@@ -434,8 +434,9 @@
 
     // 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;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12951.35048.patch
Type: text/x-patch
Size: 491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150917/d15d39dd/attachment.bin>


More information about the llvm-commits mailing list