[PATCH] D121621: [VPlan] Track current vector loop in VPTransformState (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 08:53:19 PDT 2022
fhahn added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.cpp:914
+ State->CurrentVectorLoop = L;
State->CFG.LastBB = L->getExitBlock();
----------------
Ayal wrote:
> Ayal wrote:
> > Is CFG.LastBB now redundant, retrievable from CurrentVectorLoop->getExitBlock()?
> > (Or could CurrentVectorLoop be retrieved from LastBB'd predecessor, if unique.)
> (State->CurrentVectorLoop itself is also caching of State->LI->getLoopFor(State->CFG.VectorHeaderBB))
> Is CFG.LastBB now redundant, retrievable from CurrentVectorLoop->getExitBlock()?
Unfortunately this only works if we maintain a correct branch to the exit block throughout VPlan execution. But we change the header branch to unreachable, so the won't work I think.
> (Or could CurrentVectorLoop be retrieved from LastBB'd predecessor, if unique.)
> (State->CurrentVectorLoop itself is also caching of State->LI->getLoopFor(State->CFG.VectorHeaderBB))
The main motivation for this change is to be able to create new loop objects for each non-replicator region during VPRegionBlock::execute. At that point, no basic blocks for the loop exist and when creating the first block in the loop (in VPBasicBlock::execute), there's no previous block we could use to get the loop object. We could change VPRegionBlock::execute to create a dummy block on entry, but keeping track of the loop object explicitly seems cleaner to me.
================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:358
SmallPtrSet<VPRecipeBase *, 16> MayGeneratePoisonRecipes;
+
+ Loop *CurrentVectorLoop = nullptr;
----------------
Ayal wrote:
> Worth documenting?
Thanks, I added a comment!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121621/new/
https://reviews.llvm.org/D121621
More information about the llvm-commits
mailing list