[llvm] [LV] Rework legacy widen/replicate in tryToBuildVPlan (NFC) (PR #224569)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 00:05:32 PDT 2026
================
@@ -6610,50 +6604,45 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VPlanPtr Plan,
RUN_VPLAN_PASS(VPlanTransforms::makeCallWideningDecisions, *Plan, Range,
RecipeBuilder, CostCtx);
- // Now process all other blocks and instructions.
- for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
- // Convert input VPInstructions to widened recipes.
- for (VPRecipeBase &R : make_early_inc_range(
- make_range(VPBB->getFirstNonPhi(), VPBB->end()))) {
- // Skip recipes that do not need transforming or have already been
- // transformed.
- if (isa<VPWidenCanonicalIVRecipe, VPBlendRecipe, VPReductionRecipe,
- VPReplicateRecipe, VPWidenLoadRecipe, VPWidenStoreRecipe,
- VPWidenCallRecipe, VPWidenIntrinsicRecipe, VPVectorPointerRecipe,
- VPVectorEndPointerRecipe, VPHistogramRecipe>(&R) ||
- (Instruction::isCast(cast<VPInstruction>(R).getOpcode()) &&
- vputils::onlyFirstLaneUsed(R.getVPSingleValue())))
+ // Convert remaining VPInstructions to widen or replicate recipes.
+ // TODO: This legacy code should eventually be migrated to VPlan.
+ VPBasicBlock *HeaderVPBB = LoopRegion->getEntryBasicBlock();
+ for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+ vp_depth_first_shallow(HeaderVPBB))) {
+ for (VPInstruction &VPI :
+ make_early_inc_range(make_isa_range<VPInstruction>(*VPBB))) {
+ // We represent single-scalar casts directly as VPInstructions.
+ if (Instruction::isCast(VPI.getOpcode()) &&
+ vputils::onlyFirstLaneUsed(&VPI))
continue;
----------------
artagnon wrote:
Added back an assert now, thanks.
https://github.com/llvm/llvm-project/pull/224569
More information about the llvm-commits
mailing list