[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
================
@@ -785,10 +805,44 @@ static void dissolveReplicateRegion(VPRegionBlock *Region, ElementCount VF,
// single-scalar.
convertRecipesInRegionBlocksToSingleScalar(Plan, IdxTy, FirstLaneEntry, VF);
+ // For scalar VF, just wire the blocks and return; no cloning or packing
+ // needed.
+ if (VF.isScalar()) {
+ VPBlockUtils::connectBlocks(Predecessor, FirstLaneEntry);
+ VPBlockUtils::connectBlocks(FirstLaneExiting, Successor);
+ return;
+ }
+
+ // Collect VPWidenPHIRecipes and create BuildStructVector for struct-typed
+ // VPPhis from the first lane's exiting block.
+ unsigned NumLanes = VF.getFixedValue();
+ SmallVector<VPWidenPHIRecipe *> CurrentLanePhis;
+ VPTypeAnalysis TypeInfo(Plan);
+ VPBasicBlock *ExitingBB = FirstLaneExiting;
+ SmallVector<VPInstruction *> BuildVectors;
+ for (auto &R : ExitingBB->phis()) {
+ auto *Phi = cast<VPPhi>(&R);
+ if (vputils::onlyFirstLaneUsed(Phi) || VF.isScalar())
+ continue;
+
+ Type *ScalarTy = TypeInfo.inferScalarType(Phi);
----------------
fhahn wrote:
done thanks
https://github.com/llvm/llvm-project/pull/189022
More information about the llvm-commits
mailing list