[llvm] [VPlan] Return Max from computeCost without underlying instrs. (PR #109708)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 6 06:03:51 PDT 2024
================
@@ -293,9 +285,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.
+ if (RecipeCost == InstructionCost::getMax())
+ RecipeCost = 0;
----------------
fhahn wrote:
Yes exactly. Not sure if it would be worth adding a new state for this very specific use case?
https://github.com/llvm/llvm-project/pull/109708
More information about the llvm-commits
mailing list