aboutsummaryrefslogtreecommitdiffstats
path: root/tools/opt
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-13 19:35:21 +0000
committerChris Lattner <sabre@nondot.org>2008-07-13 19:35:21 +0000
commit3dda08ad5d52a510ba2239cc4b73757db303a095 (patch)
treeb8f499e08d609c1cf3816a45f4a856fdf5fa302c /tools/opt
parent9322fe02ddc6ee9fbd21b1603f116d48a38c7eea (diff)
downloadexternal_llvm-3dda08ad5d52a510ba2239cc4b73757db303a095.zip
external_llvm-3dda08ad5d52a510ba2239cc4b73757db303a095.tar.gz
external_llvm-3dda08ad5d52a510ba2239cc4b73757db303a095.tar.bz2
Fix PR2231 - opt -internalize -std-compile-opts should run internalize first
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/opt.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 19dcb2b..08acbe8 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -379,18 +379,21 @@ int main(int argc, char **argv) {
// Add an appropriate TargetData instance for this module...
Passes.add(new TargetData(M.get()));
- // If -std-compile-opts is given, add in all the standard compilation
- // optimizations first. This will handle -strip-debug, -disable-inline,
- // and -disable-opt as well.
- if (StandardCompileOpts)
- AddStandardCompilePasses(Passes);
-
- // otherwise if the -strip-debug command line option was specified, add it.
- else if (StripDebug)
+ // If the -strip-debug command line option was specified, add it. If
+ // -std-compile-opts was also specified, it will handle StripDebug.
+ if (StripDebug && !StandardCompileOpts)
addPass(Passes, createStripSymbolsPass(true));
// Create a new optimization pass for each one specified on the command line
for (unsigned i = 0; i < PassList.size(); ++i) {
+ // Check to see if -std-compile-opts we specified before this option. If
+ // so, handle it.
+ if (StandardCompileOpts &&
+ StandardCompileOpts.getPosition() < PassList.getPosition(i)) {
+ AddStandardCompilePasses(Passes);
+ StandardCompileOpts = false;
+ }
+
const PassInfo *PassInf = PassList[i];
Pass *P = 0;
if (PassInf->getNormalCtor())
@@ -418,6 +421,12 @@ int main(int argc, char **argv) {
if (PrintEachXForm)
Passes.add(new PrintModulePass(&cerr));
}
+
+ // If -std-compile-opts was specified at the end of the pass list, add them.
+ if (StandardCompileOpts) {
+ AddStandardCompilePasses(Passes);
+ StandardCompileOpts = false;
+ }
// Check that the module is well formed on completion of optimization
if (!NoVerify && !VerifyEach)