[PATCH] D154205: [MachineLICM] Handle subloops

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 07:41:11 PDT 2023


jaykang10 added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineLICM.cpp:135
     // Exit blocks for CurLoop.
     SmallVector<MachineBasicBlock *, 8> ExitBlocks;
 
----------------
dmgreen wrote:
> jaykang10 wrote:
> > dmgreen wrote:
> > > jaykang10 wrote:
> > > > dmgreen wrote:
> > > > > Will ExitBlocks be incorrect now?
> > > > Ah, that is good point!
> > > > They are out-most loop's ExitBlocks.
> > > > Let me fix it.
> > > > Thanks for checking it.
> > > > 
> > > Could this use CurLoop->isLoopExiting(ExitBlocks) instead? It might be quicker for larger loops.
> > This function checks exit blocks which are outside loop and have predecessor inside loop.
> > isLoopExiting checks exiting blocks which are inside loop and have successor outside loop.
> > I think we need exit blocks here.
> > Let me try to keep the exit blocks for each loop in order to avoid re-calculation.
> Oh I see. A different type of Exit Block.
> Could it check `!CurLoop->contains(ExitBlocks) && any_of(ExitBlocks->predecessors, is in CurLoop)`?
`CurLoop->getExitBlocks` collects blocks which are outside CurLoop and has predecessor in CurLoop.
This function checks the MBB parameter is in the blocks.


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

https://reviews.llvm.org/D154205



More information about the llvm-commits mailing list