Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: build/config/compiler/BUILD.gn

Issue 2078223002: Add a dedicated "optimize_speed" config to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update w/ review feedback, call it "optimize_speed" instead and make it cross-platform Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/opus/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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") {
« no previous file with comments | « no previous file | third_party/opus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698