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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 4bbc34f4e7d0cc77a69d13856bbd843c116a0dab..24e29d24518870695577ea35c09633ade59ef7be 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1245,14 +1245,16 @@ if (is_win) {
common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding.
}
if (is_official_build) {
- common_optimize_on_ldflags += [
- "/OPT:REF", # Remove unreferenced data.
- "/LTCG", # Link-time code generation.
+ common_optimize_on_ldflags += [ "/OPT:REF" ] # Remove unreferenced data.
+ if (!use_lld) {
+ common_optimize_on_ldflags += [
+ "/LTCG", # Link-time code generation.
- # Set the number of LTCG code-gen threads to eight. The default is four.
- # This gives a 5-10% link speedup.
- "/cgthreads:8",
- ]
+ # Set the number of LTCG code-gen threads to eight. The default is four.
+ # This gives a 5-10% link speedup.
+ "/cgthreads:8",
+ ]
+ }
if (full_wpo_on_official) {
arflags = [ "/LTCG" ]
}
@@ -1404,17 +1406,20 @@ config("optimize_max") {
# 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.
+ if (is_official_build) {
+ if (!is_clang) {
+ cflags += [
+ "/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
- # 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",
- ]
+ # 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",
+ ]
+ } else if (is_clang && use_lld) {
+ cflags += [ "-flto" ] # Link-time optimization (whole program optimization).
+ }
}
} else {
cflags = [ "-O2" ] + common_optimize_on_cflags
« 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