[PATCH] D22368: Replace hot-callsite based heuristic to use its own threshold parameter instead of share inline-hint parameter
Dehao Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 10:02:53 PDT 2016
danielcdh created this revision.
danielcdh added reviewers: eraman, davidxl.
danielcdh added a subscriber: llvm-commits.
Hot callsites should have higher threshold than inline hints. This patch uses separate threshold parameter for hot callsites.
https://reviews.llvm.org/D22368
Files:
lib/Analysis/InlineCost.cpp
test/Transforms/Inline/inline-hot-callsite.ll
Index: test/Transforms/Inline/inline-hot-callsite.ll
===================================================================
--- test/Transforms/Inline/inline-hot-callsite.ll
+++ test/Transforms/Inline/inline-hot-callsite.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -inline -inline-threshold=0 -inlinehint-threshold=100 -S | FileCheck %s
+; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
; This tests that a hot callsite gets the (higher) inlinehint-threshold even without
; without inline hints and gets inlined because the cost is less than
Index: lib/Analysis/InlineCost.cpp
===================================================================
--- lib/Analysis/InlineCost.cpp
+++ lib/Analysis/InlineCost.cpp
@@ -66,6 +66,11 @@
"inlinecold-threshold", cl::Hidden, cl::init(225),
cl::desc("Threshold for inlining functions with cold attribute"));
+static cl::opt<int>
+ HotCallSiteThreshold("hot-callsite-threshold", cl::Hidden, cl::init(3000),
+ cl::ZeroOrMore,
+ cl::desc("Threshold for hot callsites "));
+
namespace {
class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
@@ -643,11 +648,14 @@
// when it would increase the threshold and the caller does not need to
// minimize its size.
bool InlineHint = Callee.hasFnAttribute(Attribute::InlineHint) ||
- PSI->isHotFunction(&Callee) ||
- HotCallsite;
+ PSI->isHotFunction(&Callee);
if (InlineHint && HintThreshold > Threshold && !Caller->optForMinSize())
Threshold = HintThreshold;
+ if (HotCallsite && HotCallSiteThreshold > Threshold &&
+ !Caller->optForMinSize())
+ Threshold = HotCallSiteThreshold;
+
bool ColdCallee = PSI->isColdFunction(&Callee);
// Command line argument for DefaultInlineThreshold will override the default
// ColdThreshold. If we have -inline-threshold but no -inlinecold-threshold,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22368.63998.patch
Type: text/x-patch
Size: 1965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160714/4dcacfc4/attachment.bin>
More information about the llvm-commits
mailing list