diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-10-23 23:49:31 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-10-23 23:49:31 +0000 |
commit | 592d84974c12c0d47b411509e3dc636dc105e4fa (patch) | |
tree | 5b3469ceedbfcee0e9d7b7facb3256a0e5f977ef | |
parent | eb229ca928103eb5dd82030544598d21816fb813 (diff) | |
download | bcm5719-llvm-592d84974c12c0d47b411509e3dc636dc105e4fa.tar.gz bcm5719-llvm-592d84974c12c0d47b411509e3dc636dc105e4fa.zip |
If requested, apply function merging at -O0 too. It's useful there to reduce the time to compile.
llvm-svn: 220537
-rw-r--r-- | llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index 4e048b7e91a..92f49d3f645 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -159,18 +159,22 @@ void PassManagerBuilder::populateFunctionPassManager(FunctionPassManager &FPM) { } void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) { - // If all optimizations are disabled, just run the always-inline pass. + // If all optimizations are disabled, just run the always-inline pass and, + // if enabled, the function merging pass. if (OptLevel == 0) { if (Inliner) { MPM.add(Inliner); Inliner = nullptr; } - // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC - // pass manager, but we don't want to add extensions into that pass manager. - // To prevent this we must insert a no-op module pass to reset the pass - // manager to get the same behavior as EP_OptimizerLast in non-O0 builds. - if (!GlobalExtensions->empty() || !Extensions.empty()) + // FIXME: The BarrierNoopPass is a HACK! The inliner pass above implicitly + // creates a CGSCC pass manager, but we don't want to add extensions into + // that pass manager. To prevent this we insert a no-op module pass to reset + // the pass manager to get the same behavior as EP_OptimizerLast in non-O0 + // builds. The function merging pass is + if (MergeFunctions) + MPM.add(createMergeFunctionsPass()); + else if (!GlobalExtensions->empty() || !Extensions.empty()) MPM.add(createBarrierNoopPass()); addExtensionsToPM(EP_EnabledOnOptLevel0, MPM); |