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

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 23:51:32 PDT 2026


================
@@ -3356,7 +3356,27 @@ void VPReductionEVLRecipe::execute(VPTransformState &State) {
     Mask = Builder.CreateVectorSplat(State.VF, Builder.getTrue());
 
   Value *NewRed;
-  if (isOrdered()) {
+  if (isPartialReduction()) {
+    // For partial reduction, we need to generate the predicated select
+    // (vp.merge) since `@llvm.vector.partial.reduce()` doesn't have vector
+    // predicated version.
+    VectorType *VecTy = cast<VectorType>(VecOp->getType());
+    Value *Identity = getRecurrenceIdentity(Kind, VecTy->getElementType(),
+                                            getFastMathFlagsOrNone());
+    if (State.VF.isVector())
----------------
ElvisWang123 wrote:

Added, thanks!

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


More information about the llvm-commits mailing list