[llvm] [VPlan] Move predication to VPlanTransform (NFC). (PR #128420)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 20 07:01:46 PDT 2025
================
@@ -9442,43 +9232,32 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range,
}
// ---------------------------------------------------------------------------
- // Construct recipes for the instructions in the loop
+ // Predicate and linearize the top-level loop region.
// ---------------------------------------------------------------------------
+ DenseMap<VPBasicBlock *, VPValue *> BlockMaskCache;
+ VPlanTransforms::predicateAndLinearize(*Plan, CM.foldTailByMasking(),
+ BlockMaskCache);
- VPRegionBlock *LoopRegion = Plan->getVectorLoopRegion();
- VPBasicBlock *HeaderVPBB = LoopRegion->getEntryBasicBlock();
- BasicBlock *HeaderBB = OrigLoop->getHeader();
- bool NeedsMasks =
- CM.foldTailByMasking() ||
- any_of(OrigLoop->blocks(), [this, HeaderBB](BasicBlock *BB) {
- bool NeedsBlends = BB != HeaderBB && !BB->phis().empty();
- return Legal->blockNeedsPredication(BB) || NeedsBlends;
- });
-
+ // ---------------------------------------------------------------------------
+ // Construct recipes for the instructions in the loop
----------------
ayalz wrote:
```suggestion
// Construct wide recipes and apply predication for original scalar VPInstructions in the loop.
```
?
Follow-up: outline this into a VPlanTransform?
https://github.com/llvm/llvm-project/pull/128420
More information about the llvm-commits
mailing list