Skip to content

Commit 8a91f6b

Browse files
committed
[VPlan] Use CurrentParentLoop instead of looking up via CFG (NFC).
There is no need to look up the current parent loop via LoopInfo and the vector preheader; we can simply use CurrentParentLoop.
1 parent 93b8ef4 commit 8a91f6b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,15 +752,13 @@ void VPRegionBlock::execute(VPTransformState *State) {
752752

753753
if (!isReplicator()) {
754754
// Create and register the new vector loop.
755-
Loop *PrevLoop = State->CurrentParentLoop;
755+
Loop *PrevParentLoop = State->CurrentParentLoop;
756756
State->CurrentParentLoop = State->LI->AllocateLoop();
757-
BasicBlock *VectorPH = State->CFG.VPBB2IRBB[getPreheaderVPBB()];
758-
Loop *ParentLoop = State->LI->getLoopFor(VectorPH);
759757

760758
// Insert the new loop into the loop nest and register the new basic blocks
761759
// before calling any utilities such as SCEV that require valid LoopInfo.
762-
if (ParentLoop)
763-
ParentLoop->addChildLoop(State->CurrentParentLoop);
760+
if (PrevParentLoop)
761+
PrevParentLoop->addChildLoop(State->CurrentParentLoop);
764762
else
765763
State->LI->addTopLevelLoop(State->CurrentParentLoop);
766764

@@ -770,7 +768,7 @@ void VPRegionBlock::execute(VPTransformState *State) {
770768
Block->execute(State);
771769
}
772770

773-
State->CurrentParentLoop = PrevLoop;
771+
State->CurrentParentLoop = PrevParentLoop;
774772
return;
775773
}
776774

0 commit comments

Comments
 (0)