[llvm] [VPlan] Introduce reduction selects for tail folding in foldTailByMasking. NFCI (PR #192987)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 05:46:05 PDT 2026


================
@@ -8034,23 +8040,28 @@ void LoopVectorizationPlanner::addReductionResultComputation(
     const RecurrenceDescriptor &RdxDesc = Legal->getRecurrenceDescriptor(
         cast<PHINode>(PhiR->getUnderlyingInstr()));
     Type *PhiTy = TypeInfo.inferScalarType(PhiR);
-    // If tail is folded by masking, introduce selects between the phi
-    // and the users outside the vector region of each reduction, at the
-    // beginning of the dedicated latch block.
+
+    // Convert a VPBlendRecipe backedge to a select.
+    if (auto *Blend = dyn_cast<VPBlendRecipe>(PhiR->getBackedgeValue())) {
----------------
david-arm wrote:

Where does this blend come from? I can't see it being created anywhere in this PR. If it's independent of the change to `foldTailByMasking` can they be in separate PRs?

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


More information about the llvm-commits mailing list