[llvm] [VPlan] Factor out logic to common compute costs to helper (NFCI). (PR #153361)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 02:01:23 PDT 2025


================
@@ -898,6 +898,13 @@ struct VPRecipeWithIRFlags : public VPSingleDefRecipe, public VPIRFlags {
   }
 
   void execute(VPTransformState &State) override = 0;
+
+  /// Compute the cost for this recipe using \p Opcode. If \p IsVector is true,
----------------
david-arm wrote:

nit: Perhaps better to also mention the VF and CostKind, and also explain the apparent contradiction between \p IsVector and \p VF in some cases, i.e. something like

```
  /// Compute the cost for this recipe using \p Opcode, the vector's
  /// ElementCount \p VF and the cost kind specified by \p Ctx.CostKind.
  /// If \p IsVector is true, ...
  /// NOTE: \p IsVector may contradict \p VF in cases where only the
  /// first lane of the vector is used.
```

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


More information about the llvm-commits mailing list