[llvm] [CostModel] Remove optional from InstructionCost::getValue() (PR #135596)
    Simon Pilgrim via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Apr 21 01:50:12 PDT 2025
    
    
  
================
@@ -205,8 +205,7 @@ static CostType calculateFunctionCosts(GetTTIFn GetTTI, Module &M,
             TTI.getInstructionCost(&I, TargetTransformInfo::TCK_CodeSize);
         assert(Cost != InstructionCost::getMax());
         // Assume expensive if we can't tell the cost of an instruction.
-        CostType CostVal =
-            Cost.getValue().value_or(TargetTransformInfo::TCC_Expensive);
+        CostType CostVal = Cost.getValueOr(TargetTransformInfo::TCC_Expensive);
----------------
RKSimon wrote:
(side note) I'd dearly like to get rid of TCC_Expensive entirely - the value of 4 doesn't really mean that much, especially for different CostKinds, and saying that it represents the cost of a typical x86 div instruction is just wrong.
https://github.com/llvm/llvm-project/pull/135596
    
    
More information about the llvm-commits
mailing list