Commit ae27a35d authored by Hans Wennborg's avatar Hans Wennborg

[build] Enable the ThinLTO cache also on Windows

This speeds up builds when using ThinLTO. The resource leak preventing
this from being enabled before has been fixed upstream.

The only bots doing ThinLTO builds on Windows are ToT bots that use
upstream clang.

Bug: 871962
Change-Id: Ie7a250a5bab009a95f919631b5f268aafdcdffab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637620
Commit-Queue: Hans Wennborg <hans@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844776}
parent 1b89cce2
...@@ -616,10 +616,11 @@ config("compiler") { ...@@ -616,10 +616,11 @@ config("compiler") {
lto_opt_level = 0 lto_opt_level = 0
} }
# Limit the size of the ThinLTO cache to the lesser of 10% of
# available disk space, 10GB and 100000 files.
cache_policy = "cache_size=10%:cache_size_bytes=10g:cache_size_files=100000"
if (is_win) { if (is_win) {
# This is a straight translation of the non-Windows flags below,
# except we do not use the ThinLTO cache, which leaks temporary
# files on Windows (https://crbug.com/871962).
ldflags += [ ldflags += [
"/opt:lldlto=" + lto_opt_level, "/opt:lldlto=" + lto_opt_level,
"/opt:lldltojobs=all", "/opt:lldltojobs=all",
...@@ -627,6 +628,10 @@ config("compiler") { ...@@ -627,6 +628,10 @@ config("compiler") {
# Experimentally determined to yield a reasonable trade-off between # Experimentally determined to yield a reasonable trade-off between
# build time, run-time performance, and binary size. # build time, run-time performance, and binary size.
"-mllvm:-import-instr-limit=10", "-mllvm:-import-instr-limit=10",
"/lldltocache:" +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"/lldltocachepolicy:$cache_policy",
] ]
} else { } else {
ldflags += [ "-flto=thin" ] ldflags += [ "-flto=thin" ]
...@@ -641,10 +646,6 @@ config("compiler") { ...@@ -641,10 +646,6 @@ config("compiler") {
# of "all" which means number of hardware threads) is faster. # of "all" which means number of hardware threads) is faster.
ldflags += [ "-Wl,--thinlto-jobs=all" ] ldflags += [ "-Wl,--thinlto-jobs=all" ]
# Limit the size of the ThinLTO cache to the lesser of 10% of
# available disk space, 10GB and 100000 files.
cache_policy =
"cache_size=10%:cache_size_bytes=10g:cache_size_files=100000"
ldflags += [ ldflags += [
"-Wl,--thinlto-cache-dir=" + "-Wl,--thinlto-cache-dir=" +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir), rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment