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

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 07:01:43 PDT 2024


================
@@ -312,15 +311,19 @@ InstructionCost VPRecipeBase::cost(ElementCount VF, VPCostContext &Ctx) {
 InstructionCost VPRecipeBase::computeCost(ElementCount VF,
                                           VPCostContext &Ctx) const {
   // Compute the cost for the recipe falling back to the legacy cost model using
-  // the underlying instruction. If there is no underlying instruction, returns
-  // 0.
+  // the underlying instruction. If there is no underlying instruction or the
+  // cost is computed by the recipe's computeCost, returns
+  // InstructionCost::getMax. It is used as  a sentinel value to detect recipes
+  // without underlying instructions for which no forced target instruction cost
+  // should be applied.
+
   Instruction *UI = getInstructionForCost(this);
   if (UI && isa<VPReplicateRecipe>(this)) {
----------------
ayalz wrote:

(independent) Have VPReplicateRecipe::computeCost() take care of inserting UI into SkipCostComputation?

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


More information about the llvm-commits mailing list