diff options
author | Easwaran Raman <eraman@google.com> | 2017-06-28 13:33:49 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@google.com> | 2017-06-28 13:33:49 +0000 |
commit | 8249fac52dbd676a778be80b47b2eab2234fd41d (patch) | |
tree | 2ccb7fa13e1033ce07f5ab29077d26c66c2e807e | |
parent | 538b8d25f03a55e6169247e45b3f43d0c87feaf6 (diff) | |
download | bcm5719-llvm-8249fac52dbd676a778be80b47b2eab2234fd41d.tar.gz bcm5719-llvm-8249fac52dbd676a778be80b47b2eab2234fd41d.zip |
Create inliner params based on size and opt levels.
Differential revision: https://reviews.llvm.org/D34309
llvm-svn: 306542
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 928dc0fa97e..78dfea1c441 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -480,6 +480,14 @@ static void addPGOInstrPasses(ModulePassManager &MPM, bool DebugLogging, 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 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level, // 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 @@ ModulePassManager PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, // 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()); |