[llvm] [VPlan] Move tail folding out of VPlanPredicator. NFC (PR #176143)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 08:21:07 PST 2026


================
@@ -8726,7 +8728,8 @@ void LoopVectorizationPlanner::addReductionResultComputation(
     auto *RR = dyn_cast<VPReductionRecipe>(OrigExitingVPV->getDefiningRecipe());
     if (!PhiR->isInLoop() && CM.foldTailByMasking() &&
         (!RR || !RR->isPartialReduction())) {
-      VPValue *Cond = RecipeBuilder.getBlockInMask(PhiR->getParent());
+      VPValue *Cond = RecipeBuilder.getBlockInMask(
+          cast<VPBasicBlock>(PhiR->getParent()->getSuccessors().front()));
----------------
lukel97 wrote:

I gave this a try and I think it's possible, it would make for a nice tidy up. But it doesn't seem to be an NFC change. I can add a TODO to move this into VPlanTransforms::foldTailByMasking as a follow up?

https://github.com/llvm/llvm-project/pull/176143


More information about the llvm-commits mailing list