mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 19:16:43 +00:00
[VPlan] Restructure code for BranchOnCond codegen. (NFCI)
Reoder code to exit early if the BranchOnCond isn't in an exiting block. This delays retrieving the parent region, which may not be present. Split off from https://github.com/llvm/llvm-project/pull/92651.
This commit is contained in:
parent
05d167fc20
commit
ab9c2b1c54
@ -442,20 +442,20 @@ Value *VPInstruction::generatePerPart(VPTransformState &State, unsigned Part) {
|
||||
return nullptr;
|
||||
|
||||
Value *Cond = State.get(getOperand(0), VPIteration(Part, 0));
|
||||
VPRegionBlock *ParentRegion = getParent()->getParent();
|
||||
VPBasicBlock *Header = ParentRegion->getEntryBasicBlock();
|
||||
|
||||
// Replace the temporary unreachable terminator with a new conditional
|
||||
// branch, hooking it up to backward destination for exiting blocks now and
|
||||
// to forward destination(s) later when they are created.
|
||||
BranchInst *CondBr =
|
||||
Builder.CreateCondBr(Cond, Builder.GetInsertBlock(), nullptr);
|
||||
|
||||
if (getParent()->isExiting())
|
||||
CondBr->setSuccessor(1, State.CFG.VPBB2IRBB[Header]);
|
||||
|
||||
CondBr->setSuccessor(0, nullptr);
|
||||
Builder.GetInsertBlock()->getTerminator()->eraseFromParent();
|
||||
|
||||
if (!getParent()->isExiting())
|
||||
return CondBr;
|
||||
|
||||
VPRegionBlock *ParentRegion = getParent()->getParent();
|
||||
VPBasicBlock *Header = ParentRegion->getEntryBasicBlock();
|
||||
CondBr->setSuccessor(1, State.CFG.VPBB2IRBB[Header]);
|
||||
return CondBr;
|
||||
}
|
||||
case VPInstruction::BranchOnCount: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user