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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 23:01:22 PDT 2026


================
@@ -227,6 +227,31 @@ 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))) {
+      // Decompose first and construct with EVL recipes later.
+      SmallVector<VPSingleDefRecipe *> ExpressionRecipes(Expr->decompose());
+
+      // Convert recipes to EVL recipes.
+      for (auto [Idx, ExprR] : enumerate(ExpressionRecipes))
+        if (auto *EVLR = cast_if_present<VPSingleDefRecipe>(
+                optimizeMaskToEVL(HeaderMask, *ExprR, EVL))) {
+          VPSingleDefRecipe *OrigR = ExpressionRecipes[Idx];
----------------
fhahn wrote:

is there a reason we cannot use `ExprR` here?

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


More information about the llvm-commits mailing list