[PATCH] D80229: [Inlining] Set inline-deferral-scale to 2.
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 12:37:07 PDT 2020
kazu created this revision.
kazu added a reviewer: davidxl.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a project: LLVM.
This patch sets inline-deferral-scale to 2.
Both internal and SPEC benchmarking show that 2 is the best number
among -1, 2, 3, and 4.
inline-deferral-scale SPECint2006
----------------------------------
-1 38.0 (the default without this patch)
2 38.5
3 38.1
4 38.1
With the new default number, shouldBeDeferred returns true if:
TotalCost < IC.getCost() * 2
where
TotalCost is TotalSecondaryCost + IC.getCost() * NumCallerUsers.
If TotalCost >= 0 and NumCallerUsers >= 2, then
TotalCost >= IC.getCost() * 2, so shouldBeDeferred returns true only
when NumCallerUsers is 1.
Now, if TotalSecondaryCost < 0, which can happen if
InlineConstants::LastCallToStaticBonus, a huge number, has been
subtracted from TotalSecondaryCost, then TotalCost may be negative.
In this case, shouldBeDeferred may return true even when
NumCallerUsers >= 2.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80229
Files:
llvm/lib/Analysis/InlineAdvisor.cpp
Index: llvm/lib/Analysis/InlineAdvisor.cpp
===================================================================
--- llvm/lib/Analysis/InlineAdvisor.cpp
+++ llvm/lib/Analysis/InlineAdvisor.cpp
@@ -45,7 +45,7 @@
static cl::opt<int>
InlineDeferralScale("inline-deferral-scale",
cl::desc("Scale to limit the cost of inline deferral"),
- cl::init(-1), cl::Hidden);
+ cl::init(2), cl::Hidden);
namespace {
class DefaultInlineAdvice : public InlineAdvice {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80229.264990.patch
Type: text/x-patch
Size: 530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/ad02735e/attachment-0001.bin>
More information about the llvm-commits
mailing list