[llvm] dd3de59 - [CostModel] Fix InlineSizeEstimatorAnalysis after #135596
David Green via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 23 00:20:17 PDT 2025
Author: David Green
Date: 2025-04-23T08:20:12+01:00
New Revision: dd3de590ebd63566a1a54eb0e2140c433a9add84
URL: https://github.com/llvm/llvm-project/commit/dd3de590ebd63566a1a54eb0e2140c433a9add84
DIFF: https://github.com/llvm/llvm-project/commit/dd3de590ebd63566a1a54eb0e2140c433a9add84.diff
LOG: [CostModel] Fix InlineSizeEstimatorAnalysis after #135596
Fix a reference to getValue() being optional in InlineSizeEstimatorAnalysis, a
file that is not included in the default build. A "warning: enumerated and
non-enumerated type in conditional expression" warning is fixed in AMDGPU too.
Added:
Modified:
llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
index fcecfc795b571..fc635726a6aa4 100644
--- a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
+++ b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
@@ -128,8 +128,9 @@ size_t getSize(Function &F, TargetTransformInfo &TTI) {
size_t Ret = 0;
for (const auto &BB : F)
for (const auto &I : BB)
- Ret += *(TTI.getInstructionCost(
- &I, TargetTransformInfo::TargetCostKind::TCK_CodeSize).getValue());
+ Ret += TTI.getInstructionCost(
+ &I, TargetTransformInfo::TargetCostKind::TCK_CodeSize)
+ .getValue();
return Ret;
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
index 1506f02793ba4..ed9a4d9888dc4 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
@@ -205,8 +205,9 @@ 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.isValid() ? Cost.getValue()
- : TargetTransformInfo::TCC_Expensive;
+ CostType CostVal = Cost.isValid()
+ ? Cost.getValue()
+ : (CostType)TargetTransformInfo::TCC_Expensive;
assert((FnCost + CostVal) >= FnCost && "Overflow!");
FnCost += CostVal;
}
More information about the llvm-commits
mailing list