[llvm] [CostModel] Remove optional from InstructionCost::getValue() (PR #135596)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 03:44:41 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);
----------------
alexey-bataev wrote:

Maybe just add a check here and remove `getValueOr()`?

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


More information about the llvm-commits mailing list