aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorShilei Tian <i@tianshilei.me>2024-10-11 10:19:54 -0400
committerGitHub <noreply@github.com>2024-10-11 10:19:54 -0400
commite34e27f19820af958db7c3b93de7f489aa3bf4dc (patch)
treefdedecaca1a8f490ead2a4ff1308d6a469655f5c /llvm/lib/Analysis/InlineCost.cpp
parenta8a66245954f8ef079708d314f0059d6c3e07b28 (diff)
downloadllvm-e34e27f19820af958db7c3b93de7f489aa3bf4dc.zip
llvm-e34e27f19820af958db7c3b93de7f489aa3bf4dc.tar.gz
llvm-e34e27f19820af958db7c3b93de7f489aa3bf4dc.tar.bz2
[TTI][AMDGPU] Allow targets to adjust `LastCallToStaticBonus` via `getInliningLastCallToStaticBonus` (#111311)
Currently we will not be able to inline a large function even if it only has one live use because the inline cost is still very high after applying `LastCallToStaticBonus`, which is a constant. This could significantly impact the performance because CSR spill is very expensive. This PR adds a new function `getInliningLastCallToStaticBonus` to TTI to allow targets to customize this value. Fixes SWDEV-471398.
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index d2c329b..dd9ac91 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -1943,7 +1943,7 @@ void InlineCostCallAnalyzer::updateThreshold(CallBase &Call, Function &Callee) {
// and the callsite.
int SingleBBBonusPercent = 50;
int VectorBonusPercent = TTI.getInlinerVectorBonusPercent();
- int LastCallToStaticBonus = InlineConstants::LastCallToStaticBonus;
+ int LastCallToStaticBonus = TTI.getInliningLastCallToStaticBonus();
// Lambda to set all the above bonus and bonus percentages to 0.
auto DisallowAllBonuses = [&]() {