[llvm] [VPlan] First step towards VPlan cost modeling (LegacyCM in CostCtx) (PR #92555)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 07:47:38 PDT 2024


================
@@ -701,6 +716,27 @@ class VPLiveOut : public VPUser {
 #endif
 };
 
+/// Struct to hold various analysis needed for cost computations.
+struct VPCostContext {
+  const TargetTransformInfo &TTI;
+  VPTypeAnalysis Types;
+  LLVMContext &Ctx;
+  LoopVectorizationCostModel &CM;
+  SmallPtrSet<Instruction *, 8> SkipCostComputation;
+
+  VPCostContext(const TargetTransformInfo &TTI, Type *CanIVTy, LLVMContext &Ctx,
+                LoopVectorizationCostModel &CM)
+      : TTI(TTI), Types(CanIVTy, Ctx), Ctx(Ctx), CM(CM) {}
+
+  /// Return the cost for \p UI with \p VF using the legacy cost model until
+  /// computing the cost for all recipes has been migrated to VPlan.
----------------
ayalz wrote:

```suggestion
  /// Return the cost for \p UI with \p VF using the legacy cost model as
  /// fallback until computing the cost of all recipes migrates to VPlan.
```

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


More information about the llvm-commits mailing list