[PATCH] D34309: [NewPM/Inliner] Customize threshold based on optlevel and sizelevel
Easwaran Raman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 06:34:06 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306542: Create inliner params based on size and opt levels. (authored by eraman).
Repository:
rL LLVM
https://reviews.llvm.org/D34309
Files:
llvm/trunk/lib/Passes/PassBuilder.cpp
Index: llvm/trunk/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp
+++ llvm/trunk/lib/Passes/PassBuilder.cpp
@@ -480,6 +480,14 @@
MPM.addPass(PGOInstrumentationUse(ProfileUseFile));
}
+static InlineParams
+getInlineParamsFromOptLevel(PassBuilder::OptimizationLevel Level) {
+ auto O3 = PassBuilder::O3;
+ unsigned OptLevel = Level > O3 ? 2 : Level;
+ unsigned SizeLevel = Level > O3 ? Level - O3 : 0;
+ return getInlineParams(OptLevel, SizeLevel);
+}
+
ModulePassManager
PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
bool DebugLogging) {
@@ -558,8 +566,7 @@
// Run the inliner first. The theory is that we are walking bottom-up and so
// the callees have already been fully optimized, and we want to inline them
// into the callers so that our optimizations can reflect that.
- // FIXME; Customize the threshold based on optimization level.
- MainCGPipeline.addPass(InlinerPass());
+ MainCGPipeline.addPass(InlinerPass(getInlineParamsFromOptLevel(Level)));
// Now deduce any function attributes based in the current code.
MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
@@ -868,7 +875,8 @@
// valuable as the inliner doesn't currently care whether it is inlining an
// invoke or a call.
// Run the inliner now.
- MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(InlinerPass()));
+ MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(
+ InlinerPass(getInlineParamsFromOptLevel(Level))));
// Optimize globals again after we ran the inliner.
MPM.addPass(GlobalOptPass());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34309.104407.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/199f0221/attachment.bin>
More information about the llvm-commits
mailing list