[PATCH] D45279: [LoopInterchange] Use LoopInfo::getExitBlock() instead of manual impl.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 12:14:38 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:764
+  if (InnerLoop->getExitingBlock() != InnerLoopLatch ||
+      OuterLoop->getExitingBlock() != OuterLoop->getLoopLatch()) {
+    DEBUG(dbgs() << "Loops where the latch is not the exiting block are not"
----------------
This is slightly more generous than getLoopLatchExitBlock; is it okay if the terminator of the exiting block is a switch or invoke?  Or do we check that somewhere else?


================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:865
   // TODO: We only handle LCSSA PHI's corresponding to reduction for now.
-  BasicBlock *LoopExitBlock =
-      getLoopLatchExitBlock(OuterLoopLatch, OuterLoopHeader);
-  if (!LoopExitBlock || !containsSafePHI(LoopExitBlock, true)) {
+  BasicBlock *OuterExit = OuterLoop->getExitBlock();
+  if (!OuterExit || !containsSafePHI(OuterExit, true)) {
----------------
Is it actually possible for OuterExit to be null here?


https://reviews.llvm.org/D45279





More information about the llvm-commits mailing list