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

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

Issue 2333843002: Add use_thin_lto switch to start evaluating ThinLTO. (Closed)
Patch Set: merge -flto and -whole-program-vtables flags Created 4 years, 3 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 | build/toolchain/toolchain.gni » ('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 7f4578d80b614254fad0d8eb080b9df472e851fa..41deac87733cec779a5ae34f045994fb8b9590fd 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -443,18 +443,31 @@ config("compiler") {
# TODO(pcc): Make this conditional on is_official_build rather than on gn
# flags for specific features.
if (!is_debug && (allow_posix_link_time_opt || is_cfi) && !is_nacl) {
- cflags += [ "-flto" ]
- ldflags += [ "-flto" ]
+ if (use_thin_lto) {
+ cflags += [ "-flto=thin" ]
+ ldflags += [ "-flto=thin" ]
+ } else {
+ # Note: ThinLTO does not currently have this feature implemented
+ # For Full LTO, it provides a measurable runtime speedup of Chrome.
+ cflags += [
+ "-flto",
+ "-fwhole-program-vtables",
+ ]
+ ldflags += [
+ "-flto",
+ "-fwhole-program-vtables",
+ ]
- # Apply a lower LTO optimization level as the default is too slow.
- if (is_linux) {
- if (use_lld) {
- ldflags += [ "-Wl,--lto-O1" ]
- } else {
- ldflags += [ "-Wl,-plugin-opt,O1" ]
+ # Apply a lower LTO optimization level as the default is too slow.
+ if (is_linux) {
+ if (use_lld) {
+ ldflags += [ "-Wl,--lto-O1" ]
+ } else {
+ ldflags += [ "-Wl,-plugin-opt,O1" ]
+ }
+ } else if (is_mac) {
+ ldflags += [ "-Wl,-mllvm,-O1" ]
}
- } else if (is_mac) {
- ldflags += [ "-Wl,-mllvm,-O1" ]
}
# Work-around for http://openradar.appspot.com/20356002
@@ -469,9 +482,6 @@ config("compiler") {
if (is_linux) {
ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
}
-
- cflags += [ "-fwhole-program-vtables" ]
- ldflags += [ "-fwhole-program-vtables" ]
}
# Pass the same C/C++ flags to the objective C/C++ compiler.
« no previous file with comments | « no previous file | build/toolchain/toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698