diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-10-29 07:56:11 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-29 07:56:11 +0000 |
commit | ac7ffe0102c09064588dbec758618492c9eb12c9 (patch) | |
tree | 7a6abb2bab4825649e633c066a3f920cea1de048 | |
parent | 8cda9e999fd9c525f6522fd6907928aa70fcb92c (diff) |
Improve llvm-gcc compatibility, -Os implies -O2 (sortof).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58374 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/clang.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 696e8842c9..84eb341b61 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -1140,8 +1140,14 @@ OptLevel("O", llvm::cl::Prefix, llvm::cl::init(0)); static void InitializeCompileOptions(CompileOptions &Opts) { - Opts.OptimizationLevel = OptLevel; Opts.OptimizeSize = OptSize; + if (OptSize) { + // -Os implies -O2 + // FIXME: Diagnose conflicting options. + Opts.OptimizationLevel = 2; + } else { + Opts.OptimizationLevel = OptLevel; + } // FIXME: There are llvm-gcc options to control these selectively. Opts.InlineFunctions = (Opts.OptimizationLevel > 1); |