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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 10:25:23 PDT 2018


fhahn 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"
----------------
efriedma wrote:
> 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?
Thanks for pointing that out, it was not checked anywhere else. I added checks.


================
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)) {
----------------
efriedma wrote:
> Is it actually possible for OuterExit to be null here?
I had a look and could not spot any other checks ensuring we have a unique exit block.


https://reviews.llvm.org/D45279





More information about the llvm-commits mailing list