[PATCH] D72420: [LoopRotate] Add support for rotating loops with switch exit

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 17:58:50 PST 2020


efriedma added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LoopInfoImpl.h:215
     if (contains(Pred)) {
-      if (Latch)
+      if (Latch && Latch != Pred)
         return nullptr;
----------------
Move the new check out to avoid the extra contains() call?


================
Comment at: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:283
         if (Options.PreserveLCSSA) {
-          createPHIsForSplitLoopExit(TIBB, NewBB, DestBB);
+          SmallVector<BasicBlock *, 1> Preds(NumEdges, TIBB);
+          createPHIsForSplitLoopExit(Preds, NewBB, DestBB);
----------------
I'm surprised nobody else has run into this.


================
Comment at: llvm/lib/Transforms/Utils/LoopRotationUtils.cpp:489
     // be split.
-    SmallVector<BasicBlock *, 4> ExitPreds(pred_begin(Exit), pred_end(Exit));
+    SmallPtrSet<BasicBlock *, 4> ExitPreds(pred_begin(Exit), pred_end(Exit));
     bool SplitLatchEdge = false;
----------------
This is going to cause non-deterministic code generation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72420





More information about the llvm-commits mailing list