diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-12-27 08:13:45 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-12-27 08:13:45 +0000 |
commit | f49f1a87ef49150c33d0810b3e8b0d56e56f3d1f (patch) | |
tree | 188e517b88a15913e5dcfb59034e582281b34d5f /llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | |
parent | 48a065d2eaba92c5c1221dc32810522b7aad6745 (diff) | |
download | bcm5719-llvm-f49f1a87ef49150c33d0810b3e8b0d56e56f3d1f.tar.gz bcm5719-llvm-f49f1a87ef49150c33d0810b3e8b0d56e56f3d1f.zip |
[attrs] Split off the forced attributes utility into its own pass that
is (by default) run much earlier than FuncitonAttrs proper.
This allows forcing optnone or other widely impactful attributes. It is
also a bit simpler as the force attribute behavior needs no specific
iteration order.
I've added the pass into the default module pass pipeline and LTO pass
pipeline which mirrors where function attrs itself was being run.
Differential Revision: http://reviews.llvm.org/D15668
llvm-svn: 256465
Diffstat (limited to 'llvm/lib/Transforms/IPO/PassManagerBuilder.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index 0d8982774d9..5978b8f59ca 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -31,6 +31,7 @@ #include "llvm/Analysis/TypeBasedAliasAnalysis.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Transforms/IPO.h" +#include "llvm/Transforms/IPO/ForceFunctionAttrs.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Vectorize.h" @@ -187,6 +188,9 @@ void PassManagerBuilder::populateFunctionPassManager( void PassManagerBuilder::populateModulePassManager( legacy::PassManagerBase &MPM) { + // Allow forcing function attributes as a debugging and tuning aid. + MPM.add(createForceFunctionAttrsLegacyPass()); + // If all optimizations are disabled, just run the always-inline pass and, // if enabled, the function merging pass. if (OptLevel == 0) { @@ -483,6 +487,9 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) { if (FunctionIndex) PM.add(createFunctionImportPass(FunctionIndex)); + // Allow forcing function attributes as a debugging and tuning aid. + PM.add(createForceFunctionAttrsLegacyPass()); + // Propagate constants at call sites into the functions they call. This // opens opportunities for globalopt (and inlining) by substituting function // pointers passed as arguments to direct uses of functions. |