[llvm] [VPlan] Implement VPReductionRecipe::computeCost(). NFC (PR #107790)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 18:05:45 PDT 2024


================
@@ -1999,6 +1999,27 @@ void VPReductionEVLRecipe::execute(VPTransformState &State) {
   State.set(this, NewRed, 0, /*IsScalar*/ true);
 }
 
+InstructionCost VPReductionRecipe::computeCost(ElementCount VF,
+                                               VPCostContext &Ctx) const {
+  RecurKind RdxKind = RdxDesc.getRecurrenceKind();
----------------
ElvisWang123 wrote:

Thanks, I will add an assertion to check it is not an any-of reduction.

I tried to compute the cost of in-loop reductions by the vplan-based cost model.


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


More information about the llvm-commits mailing list