Skip to content

Commit 6b68670

Browse files
[Inlining] Add PreInlineThreshold for the new pass manager
Summary: This patch makes it easy to try out different preinlining thresholds with a command-line switch just like -preinline-threshold for the legacy pass manager. Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72618
1 parent e653d30 commit 6b68670

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ static cl::opt<bool>
192192
cl::Hidden, cl::ZeroOrMore,
193193
cl::desc("Run Partial inlinining pass"));
194194

195+
static cl::opt<int> PreInlineThreshold(
196+
"npm-preinline-threshold", cl::Hidden, cl::init(75), cl::ZeroOrMore,
197+
cl::desc("Control the amount of inlining in pre-instrumentation inliner "
198+
"(default = 75)"));
199+
195200
static cl::opt<bool>
196201
RunNewGVN("enable-npm-newgvn", cl::init(false),
197202
cl::Hidden, cl::ZeroOrMore,
@@ -575,8 +580,7 @@ void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging,
575580
if (!isOptimizingForSize(Level) && !IsCS) {
576581
InlineParams IP;
577582

578-
// In the old pass manager, this is a cl::opt. Should still this be one?
579-
IP.DefaultThreshold = 75;
583+
IP.DefaultThreshold = PreInlineThreshold;
580584

581585
// FIXME: The hint threshold has the same value used by the regular inliner.
582586
// This should probably be lowered after performance testing.

0 commit comments

Comments
 (0)