[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 12:16:19 PDT 2018
fhahn 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)) {
----------------
efriedma wrote:
> 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.
There's one check to ensure the outermost loop in a nest has a unique exit block in processLoopList. Ah yes, the check Latch == single exiting block & isa<BranchInst> should guarantee that we have a unique exit block, thanks!
================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:555
+ return false;
+ }
----------------
efriedma wrote:
> What is this closing brace doing here?
>
> Also, the indentation looks weird.
Argh, sorry about that. Should be fixed now
https://reviews.llvm.org/D45279
More information about the llvm-commits
mailing list