[llvm] [VPlan] Dissolve replicate regions with vector live-outs. (PR #189022)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 10:58:14 PDT 2026
================
@@ -753,10 +758,25 @@ static void processLaneForReplicateRegion(VPlan &Plan, Type *IdxTy,
NewR.setOperand(I, NewOp);
}
+ const APInt *InsertExtractIdx;
if (auto *Steps = dyn_cast<VPScalarIVStepsRecipe>(&NewR))
addLaneToStartIndex(Steps, Lane, Plan, Steps);
- else if (match(&NewR, m_ExtractElement(m_VPValue(), m_ZeroInt())))
+ else if (match(&NewR, m_ExtractElement(m_VPValue(),
+ m_APInt(InsertExtractIdx)))) {
+ assert(InsertExtractIdx->isZero() && "insert indices must be zero");
NewR.setOperand(1, IdxLane);
+ } else if (isa<VPPhi>(&OldR)) {
+ // Update BuildStructVector operand for this lane.
+ VPUser *SingleUser = OldR.getVPSingleValue()->getSingleUser();
+ if (SingleUser &&
+ match(SingleUser,
+ m_CombineOr(
+ m_BuildVector(),
+ m_VPInstruction<VPInstruction::BuildStructVector>()))) {
+ cast<VPRecipeBase>(SingleUser)
+ ->setOperand(Lane, NewR.getVPSingleValue());
+ }
----------------
fhahn wrote:
Yep, all other recipes (VPInstructions) do not need handling, as extracts inserted during initial setup effectively must take care of extracting the correct lane.
https://github.com/llvm/llvm-project/pull/189022
More information about the llvm-commits
mailing list