[PATCH] D80477: [LoopUnroll] Support loop with multi exiting blocks

Ettore Tiotto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 25 10:42:36 PDT 2020


etiotto added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopUnroll.cpp:326
+        BI = ExitingBI;
 
+        assert(ULO.Count > 0 && "Expecting valid unroll count");
----------------
Please add a comment to explain why an exiting block conditional branch may be chosen with 'higher priority' and the rationale.


================
Comment at: llvm/lib/Transforms/Utils/LoopUnroll.cpp:639
 
-      // Keep track of the successor of the new header in the current iteration.
-      for (auto *Pred : predecessors(*BB))
-        if (Pred == Header) {
-          HeaderSucc.push_back(New);
-          break;
-        }
+      // Keep track of the exiting block and its in loop successor of the new
+      // header in the current iteration.
----------------
[Typo]: You mean:  Keep track of the exiting block and its in successor block contained in the unrolled loop current iteration ?


================
Comment at: llvm/test/Transforms/LoopUnroll/nonlatchcondbr.ll:47
+  %cmp = icmp slt i64 %inc, 4
+  br i1 %cmp, label %for.body.for.body_crit_edge, label %for.end
+
----------------
In this case the exiting block is the loop header. This case would have been handled by the existing implementation. To test your new code path you should make the exiting block not be the loop header.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80477/new/

https://reviews.llvm.org/D80477





More information about the llvm-commits mailing list