[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
================
@@ -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.
----------------
ayalz wrote:
Would be good to indicate why such a sentinel is needed, rather than detecting the absence of an underlying instruction by directly checking UI, as done now?
https://github.com/llvm/llvm-project/pull/109708
More information about the llvm-commits
mailing list