[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #147513)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 02:38:54 PST 2025


================
@@ -7023,7 +7023,8 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
       }
       // The VPlan-based cost model is more accurate for partial reduction and
       // comparing against the legacy cost isn't desirable.
-      if (isa<VPPartialReductionRecipe>(&R))
+      if (auto *VPR = dyn_cast<VPReductionRecipe>(&R);
+          VPR && VPR->isPartialReduction())
----------------
fhahn wrote:

```suggestion
      if (auto *VPR = dyn_cast<VPReductionRecipe>(&R))
        if (VPR->isPartialReduction())
```

assigning as part of the if doesn't seem to save lines and I think we generally avoid it in the vectorizer code

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


More information about the llvm-commits mailing list