[llvm] [VPlan] First step towards VPlan cost modeling. (PR #92555)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 14:39:06 PDT 2024


================
@@ -747,6 +747,65 @@ void VPRegionBlock::execute(VPTransformState *State) {
   State->Instance.reset();
 }
 
+InstructionCost VPBasicBlock::cost(ElementCount VF, VPCostContext &Ctx) {
+  InstructionCost Cost = 0;
+  for (VPRecipeBase &R : Recipes)
+    Cost += R.cost(VF, Ctx);
+  return Cost;
+}
+
+InstructionCost VPRegionBlock::cost(ElementCount VF, VPCostContext &Ctx) {
+  if (!isReplicator()) {
+    InstructionCost Cost = 0;
+    Cost += Ctx.getLoopExitCost(VF);
----------------
ayalz wrote:

Could all cost pre-computations take place in one place, either here in loop-region.cost or in LAP.cost above?

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


More information about the llvm-commits mailing list