Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 0cba95ff63396ac21889680191dd8777050cce26..481b004c6d1ac308a2a693d8f46523c42d352a79 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -1399,6 +1399,49 @@ config("optimize_max") { |
} |
} |
+# This config can be used to override the default settings for per-component |
+# and whole-program optimization, optimizing the particular target for speed |
+# instead of code size. This config is exactly the same as "optimize_max" |
+# except that we use -O3 instead of -O2 on non-win, non-IRT platforms. |
+# |
+# TODO(crbug.com/621335) - rework how all of these configs are related |
+# so that we don't need this disclaimer. |
+config("optimize_speed") { |
Nico
2016/06/21 18:10:37
bikeshed: I think it'd be good if the name contain
|
+ if (is_nacl_irt) { |
+ # The NaCl IRT is a special case and always wants its own config. |
+ # Various components do: |
+ # if (!is_debug) { |
+ # configs -= [ "//build/config/compiler:default_optimization" ] |
+ # configs += [ "//build/config/compiler:optimize_max" ] |
+ # } |
+ # So this config has to have the selection logic just like |
+ # "default_optimization", below. |
+ configs = [ "//build/config/nacl:irt_optimize" ] |
+ } else { |
+ ldflags = common_optimize_on_ldflags |
+ if (is_win) { |
+ # Favor speed over size, /O2 must be before the common flags. The GYP |
+ # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2. |
+ cflags = [ "/O2" ] + common_optimize_on_cflags |
+ |
+ # TODO(thakis): Remove is_clang here, https://crbug.com/598772 |
+ if (is_official_build && !is_clang) { |
+ cflags += [ |
+ "/GL", # Whole program optimization. |
+ |
+ # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. |
+ # Probably anything that this would catch that wouldn't be caught in a |
+ # normal build isn't going to actually be a bug, so the incremental |
+ # value of C4702 for PGO builds is likely very small. |
+ "/wd4702", |
+ ] |
Nico
2016/06/21 18:10:37
this is a lot of copy-pasta :-/
|
+ } |
+ } else { |
+ cflags = [ "-O3" ] + common_optimize_on_cflags |
+ } |
+ } |
+} |
+ |
# The default optimization applied to all targets. This will be equivalent to |
# either "optimize" or "no_optimize", depending on the build flags. |
config("default_optimization") { |