[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:47 PDT 2024


================
@@ -298,9 +293,13 @@ InstructionCost VPRecipeBase::cost(ElementCount VF, VPCostContext &Ctx) {
     return 0;
 
   InstructionCost RecipeCost = computeCost(VF, Ctx);
-  if (UI && ForceTargetInstructionCost.getNumOccurrences() > 0 &&
-      RecipeCost.isValid())
+  if (ForceTargetInstructionCost.getNumOccurrences() > 0 &&
+      (RecipeCost.isValid() && RecipeCost != InstructionCost::getMax()))
     RecipeCost = InstructionCost(ForceTargetInstructionCost);
+  // Max cost is used as a sentinel value to detect recipes without underlying
+  // instructions for which no forced target instruction cost should be applied.
----------------
fhahn wrote:

No sentinel is needed in the latest version, it uses UI now, thanks!

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


More information about the llvm-commits mailing list