[llvm] [LV] Handle partial reductions with predication (PR #194859)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 06:35:15 PDT 2026


================
@@ -6543,13 +6546,31 @@ static void transformToPartialReduction(const VPPartialReductionChain &Chain,
   }
 
   // Check if WidenRecipe is the final result of the reduction. If so look
-  // through selects for predicated reductions.
-  VPValue *Cond = nullptr;
-  VPValue *ExitValue = cast_or_null<VPInstruction>(
-      findUserOf(WidenRecipe, m_Select(m_VPValue(Cond), m_Specific(WidenRecipe),
-                                       m_Specific(RdxPhi))));
+  // through the select recipes introduced by tail-folding. When a Blend
+  // guards the reduction, the tail-fold select wraps the Blend,
+  // otherwise it wraps the WidenRecipe directly.
----------------
sdesmalen-arm wrote:

I find this a bit confusing. Is it worth just saying something like:

> If so, look through the Select recipe introduced by tail-folding or through any Blend recipe introduced by predication for the block.

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


More information about the llvm-commits mailing list