[llvm] [VPlan] Return Max from computeCost without underlying instrs. (PR #109708)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 11:58:45 PDT 2024


================
@@ -275,20 +275,15 @@ void VPRecipeBase::moveBefore(VPBasicBlock &BB,
 }
 
 /// Return the underlying instruction to be used for computing \p R's cost via
-/// the legacy cost model. Return nullptr if there's no suitable instruction.
+/// the legacy cost model. Return nullptr if there's no suitable instruction or
+/// computeCost is already implemented for the recipe and there is no need for
+/// the underlying instruction, i.e. it does not need to be skipped for cost
+/// computations.
----------------
fhahn wrote:

This has completely changed in the latest version.

I've implemented ::computeCost for recipes as needed, so there's no need to use this function with getLegacyCost. This more clearly scopes where the legacy cost is still used and how the instructions are obtained (recipe specific). There's no need to remove recipes from `getInstructionForCost` as their `computeCost` moves to not use legacy cost.

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


More information about the llvm-commits mailing list