[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:45 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
----------------
ayalz wrote:

The "else" part of the "or" is unclear, at-least in this patch alone - getMax is returned below if and only if there is no underlying instruction (assuming Ctx.getLegacyCost() never returns Max). Concrete recipes may return Max even if they have an underlying instruction?

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


More information about the llvm-commits mailing list