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

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 2390153003: Win/Clang: turn on LTO for Official builds that use LLD (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/nacl/config.gni") 8 import("//build/config/nacl/config.gni")
9 import("//build/toolchain/cc_wrapper.gni") 9 import("//build/toolchain/cc_wrapper.gni")
10 import("//build/toolchain/toolchain.gni") 10 import("//build/toolchain/toolchain.gni")
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 # This optimization can't be used when ASan is enabled because 1238 # This optimization can't be used when ASan is enabled because
1239 # it is not compatible with the ASan ODR checker. 1239 # it is not compatible with the ASan ODR checker.
1240 "/Gw", 1240 "/Gw",
1241 ] 1241 ]
1242 } 1242 }
1243 common_optimize_on_ldflags = [] 1243 common_optimize_on_ldflags = []
1244 if (!is_component_build) { 1244 if (!is_component_build) {
1245 common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding. 1245 common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding.
1246 } 1246 }
1247 if (is_official_build) { 1247 if (is_official_build) {
1248 common_optimize_on_ldflags += [ 1248 common_optimize_on_ldflags += [ "/OPT:REF" ] # Remove unreferenced data.
1249 "/OPT:REF", # Remove unreferenced data. 1249 if (!use_lld) {
1250 "/LTCG", # Link-time code generation. 1250 common_optimize_on_ldflags += [
1251 "/LTCG", # Link-time code generation.
1251 1252
1252 # Set the number of LTCG code-gen threads to eight. The default is four. 1253 # Set the number of LTCG code-gen threads to eight. The default is four.
1253 # This gives a 5-10% link speedup. 1254 # This gives a 5-10% link speedup.
1254 "/cgthreads:8", 1255 "/cgthreads:8",
1255 ] 1256 ]
1257 }
1256 if (full_wpo_on_official) { 1258 if (full_wpo_on_official) {
1257 arflags = [ "/LTCG" ] 1259 arflags = [ "/LTCG" ]
1258 } 1260 }
1259 } 1261 }
1260 } else { 1262 } else {
1261 common_optimize_on_cflags = [] 1263 common_optimize_on_cflags = []
1262 common_optimize_on_ldflags = [] 1264 common_optimize_on_ldflags = []
1263 1265
1264 if (is_android) { 1266 if (is_android) {
1265 # TODO(jdduke) Re-enable on mips after resolving linking 1267 # TODO(jdduke) Re-enable on mips after resolving linking
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 # So this config has to have the selection logic just like 1399 # So this config has to have the selection logic just like
1398 # "default_optimization", below. 1400 # "default_optimization", below.
1399 configs = [ "//build/config/nacl:irt_optimize" ] 1401 configs = [ "//build/config/nacl:irt_optimize" ]
1400 } else { 1402 } else {
1401 ldflags = common_optimize_on_ldflags 1403 ldflags = common_optimize_on_ldflags
1402 if (is_win) { 1404 if (is_win) {
1403 # Favor speed over size, /O2 must be before the common flags. The GYP 1405 # Favor speed over size, /O2 must be before the common flags. The GYP
1404 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2. 1406 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2.
1405 cflags = [ "/O2" ] + common_optimize_on_cflags 1407 cflags = [ "/O2" ] + common_optimize_on_cflags
1406 1408
1407 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 1409 if (is_official_build) {
1408 if (is_official_build && !is_clang) { 1410 if (!is_clang) {
1409 cflags += [ 1411 cflags += [
1410 "/GL", # Whole program optimization. 1412 "/GL", # Whole program optimization.
Reid Kleckner 2016/10/04 22:25:40 Should we alias /GL to -flto in clang, or do you t
hans 2016/10/04 22:28:52 Yes, I think that might be confusing. We discussed
1411 1413
1412 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. 1414 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
1413 # Probably anything that this would catch that wouldn't be caught in a 1415 # Probably anything that this would catch that wouldn't be caught
1414 # normal build isn't going to actually be a bug, so the incremental 1416 # in a normal build isn't going to actually be a bug, so the
1415 # value of C4702 for PGO builds is likely very small. 1417 # incremental value of C4702 for PGO builds is likely very small.
1416 "/wd4702", 1418 "/wd4702",
1417 ] 1419 ]
1420 } else if (is_clang && use_lld) {
1421 cflags += [ "-flto" ] # Link-time optimization (whole program optimiz ation).
1422 }
1418 } 1423 }
1419 } else { 1424 } else {
1420 cflags = [ "-O2" ] + common_optimize_on_cflags 1425 cflags = [ "-O2" ] + common_optimize_on_cflags
1421 } 1426 }
1422 } 1427 }
1423 } 1428 }
1424 1429
1425 # This config can be used to override the default settings for per-component 1430 # This config can be used to override the default settings for per-component
1426 # and whole-program optimization, optimizing the particular target for speed 1431 # and whole-program optimization, optimizing the particular target for speed
1427 # instead of code size. This config is exactly the same as "optimize_max" 1432 # instead of code size. This config is exactly the same as "optimize_max"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 1595
1591 if (is_ios || is_mac) { 1596 if (is_ios || is_mac) {
1592 # On Mac and iOS, this enables support for ARC (automatic ref-counting). 1597 # On Mac and iOS, this enables support for ARC (automatic ref-counting).
1593 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. 1598 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html.
1594 config("enable_arc") { 1599 config("enable_arc") {
1595 common_flags = [ "-fobjc-arc" ] 1600 common_flags = [ "-fobjc-arc" ]
1596 cflags_objc = common_flags 1601 cflags_objc = common_flags
1597 cflags_objcc = common_flags 1602 cflags_objcc = common_flags
1598 } 1603 }
1599 } 1604 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698