diff options
Diffstat (limited to 'clang/Driver/clang.cpp')
| -rw-r--r-- | clang/Driver/clang.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp index 696e8842c9d..84eb341b61e 100644 --- a/clang/Driver/clang.cpp +++ b/clang/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); |

