[llvm] [LV] Support EVL for partial reduction and VPExpressionRecipe. (PR #205741)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 00:38:43 PDT 2026


================
@@ -3148,6 +3119,35 @@ static VPRecipeBase *optimizeMaskToEVL(VPValue *HeaderMask,
                                            Mask ? Mask : Plan->getTrue(), &EVL},
                                           IntrR->getScalarType(), {}, {}, DL);
 
+  // Transforms the VPReductionRecipe inside the VPExpressionRecipe.
+  if (auto *Expr = dyn_cast<VPExpressionRecipe>(&CurRecipe))
+    if (match(Expr->getOperand(Expr->getNumOperands() - 1),
+              m_RemoveMask(HeaderMask, Mask))) {
+      auto PrevR = std::prev(Expr->getIterator());
+      Expr->decompose();
+      VPReductionRecipe *Red =
+          cast<VPReductionRecipe>(&*std::prev(Expr->getIterator()));
----------------
lukel97 wrote:

Thanks, this new decompose based version looks good. 

Relying on the iterator looks a bit fragile though, maybe it would be nicer if we changed the signature of `VPExpressionRecipe::decompose` to return a vector of the ExpressionRecipes that it decomposed to? 

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


More information about the llvm-commits mailing list