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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 11:55:06 PDT 2018


efriedma added inline comments.


================
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)) {
----------------
fhahn wrote:
> 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.
processLoopList contains an identical check. And I think `OuterLoop->getExitingBlock() == OuterLoop->getLoopLatch() && isa<BranchInst>(OuterLoop->getLoopLatch()->getTerminator())` implies the exit is unique. 


================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:555
+    return false;
+  }
 
----------------
What is this closing brace doing here?

Also, the indentation looks weird.


https://reviews.llvm.org/D45279





More information about the llvm-commits mailing list