[llvm] [VPlan] Introduce ExitPhi VPInstruction, use to create phi for FOR. (PR #94760)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 06:01:00 PDT 2024
================
@@ -593,13 +595,31 @@ Value *VPInstruction::generatePerPart(VPTransformState &State, unsigned Part) {
Value *Addend = State.get(getOperand(1), Part, /* IsScalar */ true);
return Builder.CreatePtrAdd(Ptr, Addend, Name);
}
+ case VPInstruction::ExitPhi: {
+ if (Part != 0)
+ return State.get(this, 0, /*IsScalar*/ true);
+ Value *IncomingFromVPlanPred =
+ State.get(getOperand(0), Part, /* IsScalar */ true);
+ Value *IncomingFromOtherPred =
+ State.get(getOperand(1), Part, /* IsScalar */ true);
+ auto *NewPhi = Builder.CreatePHI(IncomingFromOtherPred->getType(), 2, Name);
+ BasicBlock *VPlanPred =
+ State.CFG
+ .VPBB2IRBB[cast<VPBasicBlock>(getParent()->getSinglePredecessor())];
+ NewPhi->addIncoming(IncomingFromVPlanPred, VPlanPred);
+ for (auto *BB : predecessors(Builder.GetInsertBlock()))
----------------
ayalz wrote:
These `predecessors` exclude VPlanPred, namely middle block?
https://github.com/llvm/llvm-project/pull/94760
More information about the llvm-commits
mailing list