From 6b686703e63f0e992438ce445cbe4b3e78b94ea4 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 13 Jan 2020 06:34:16 -0800 Subject: [PATCH] [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 --- llvm/lib/Passes/PassBuilder.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 953b688..b05ee05 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -192,6 +192,11 @@ static cl::opt cl::Hidden, cl::ZeroOrMore, cl::desc("Run Partial inlinining pass")); +static cl::opt PreInlineThreshold( + "npm-preinline-threshold", cl::Hidden, cl::init(75), cl::ZeroOrMore, + cl::desc("Control the amount of inlining in pre-instrumentation inliner " + "(default = 75)")); + static cl::opt RunNewGVN("enable-npm-newgvn", cl::init(false), cl::Hidden, cl::ZeroOrMore, @@ -575,8 +580,7 @@ void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging, if (!isOptimizingForSize(Level) && !IsCS) { InlineParams IP; - // In the old pass manager, this is a cl::opt. Should still this be one? - IP.DefaultThreshold = 75; + IP.DefaultThreshold = PreInlineThreshold; // FIXME: The hint threshold has the same value used by the regular inliner. // This should probably be lowered after performance testing. -- 2.7.4