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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 19:50:51 PDT 2026


================
@@ -3594,8 +3614,23 @@ void VPExpressionRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
   O << " = ";
   auto *Red = cast<VPReductionRecipe>(ExpressionRecipes.back());
   unsigned Opcode = RecurrenceDescriptor::getOpcode(Red->getRecurrenceKind());
-  VPValue *RdxStart =
-      getOperand(getNumOperands() - (Red->isConditional() ? 2 : 1));
+  VPValue *Mask = getOperand(getNumOperands() - 1);
+  VPValue *EVL =
+      isa<VPReductionEVLRecipe>(Red)
+          ? getOperand(getNumOperands() - (Red->isConditional() ? 2 : 1))
+          : nullptr;
+  VPValue *RdxStart = getOperand(
+      getNumOperands() - (Red->isConditional() ? 2 : 1) - (EVL ? 1 : 0));
+  auto PrintEVLAndMask = [&]() {
+    if (EVL) {
+      O << ", ";
+      EVL->printAsOperand(O, SlotTracker);
+    }
+    if (Red->isConditional()) {
+      O << ", ";
+      Mask->printAsOperand(O, SlotTracker);
+    }
----------------
lukel97 wrote:

It would be nice to not have EVL specific code in VPExpressionRecipe, but I don't really have any ideas on how to improve this. Not blocking anyway

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


More information about the llvm-commits mailing list