diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-05-03 15:46:00 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-05-03 15:46:00 +0000 |
commit | 7f7d8be518ce76c826f69dda72fbcb08e2df3ef7 (patch) | |
tree | 2bc55bea71ae9eb67add08712b0c9b03c2417071 /llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | |
parent | b52eb8b22609594db49dde449b5bff13d3d88588 (diff) | |
download | llvm-7f7d8be518ce76c826f69dda72fbcb08e2df3ef7.zip llvm-7f7d8be518ce76c826f69dda72fbcb08e2df3ef7.tar.gz llvm-7f7d8be518ce76c826f69dda72fbcb08e2df3ef7.tar.bz2 |
Move "Eliminate Available Externally" immediately after the inliner
This pass is supposed to reduce the size of the IR for compile time
purpose. We should run it ASAP, except when we prepare for LTO or
ThinLTO, and we want to keep them available for link-time inline.
Differential Revision: http://reviews.llvm.org/D19813
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 268394
Diffstat (limited to 'llvm/lib/Transforms/IPO/PassManagerBuilder.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index 71ec8ae..7669895 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -404,6 +404,19 @@ void PassManagerBuilder::populateModulePassManager( // we must insert a no-op module pass to reset the pass manager. MPM.add(createBarrierNoopPass()); + if (!DisableUnitAtATime && OptLevel > 1 && !PrepareForLTO && + !PrepareForThinLTO) + // Remove avail extern fns and globals definitions if we aren't + // compiling an object file for later LTO. For LTO we want to preserve + // these so they are eligible for inlining at link-time. Note if they + // are unreferenced they will be removed by GlobalDCE later, so + // this only impacts referenced available externally globals. + // Eventually they will be suppressed during codegen, but eliminating + // here enables more opportunity for GlobalDCE as it may make + // globals referenced by available external functions dead + // and saves running remaining passes on the eliminated functions. + MPM.add(createEliminateAvailableExternallyPass()); + if (!DisableUnitAtATime) MPM.add(createReversePostOrderFunctionAttrsPass()); @@ -428,18 +441,6 @@ void PassManagerBuilder::populateModulePassManager( MPM.add(createLICMPass()); // Hoist loop invariants } - if (!DisableUnitAtATime && OptLevel > 1 && !PrepareForLTO) - // Remove avail extern fns and globals definitions if we aren't - // compiling an object file for later LTO. For LTO we want to preserve - // these so they are eligible for inlining at link-time. Note if they - // are unreferenced they will be removed by GlobalDCE later, so - // this only impacts referenced available externally globals. - // Eventually they will be suppressed during codegen, but eliminating - // here enables more opportunity for GlobalDCE as it may make - // globals referenced by available external functions dead - // and saves running remaining passes on the eliminated functions. - MPM.add(createEliminateAvailableExternallyPass()); - if (PerformThinLTO) { // Remove dead fns and globals. Removing unreferenced functions could lead // to more opportunities for globalopt. |