summaryrefslogtreecommitdiffstats
path: root/clang/Driver/clang.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-10-29 07:56:11 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-10-29 07:56:11 +0000
commite74f2c263317cf7679f7759b6b267f7394ea2e31 (patch)
tree413b8f7dad12726f410b99c5cb3b01f0f0628b9c /clang/Driver/clang.cpp
parent9c15820ea6069691370c5a88c45942a3967ca289 (diff)
downloadbcm5719-llvm-e74f2c263317cf7679f7759b6b267f7394ea2e31.tar.gz
bcm5719-llvm-e74f2c263317cf7679f7759b6b267f7394ea2e31.zip
Improve llvm-gcc compatibility, -Os implies -O2 (sortof).
llvm-svn: 58374
Diffstat (limited to 'clang/Driver/clang.cpp')
-rw-r--r--clang/Driver/clang.cpp8
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);
OpenPOWER on IntegriCloud