[llvm] 6b68670 - [Inlining] Add PreInlineThreshold for the new pass manager

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 08:00:55 PST 2020


Author: Kazu Hirata
Date: 2020-01-13T07:59:42-08:00
New Revision: 6b686703e63f0e992438ce445cbe4b3e78b94ea4

URL: https://github.com/llvm/llvm-project/commit/6b686703e63f0e992438ce445cbe4b3e78b94ea4
DIFF: https://github.com/llvm/llvm-project/commit/6b686703e63f0e992438ce445cbe4b3e78b94ea4.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Passes/PassBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 953b688c7f8e..b05ee0537eb0 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -192,6 +192,11 @@ static cl::opt<bool>
                        cl::Hidden, cl::ZeroOrMore,
                        cl::desc("Run Partial inlinining pass"));
 
+static cl::opt<int> 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<bool>
     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.


        


More information about the llvm-commits mailing list