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

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

Issue 2375783002: Add an `auto_profile_path` flag to GN to control AFDO. (Closed)
Patch Set: test based on toolchain instead 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 | « build/config/BUILDCONFIG.gn ('k') | 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 5fcc050b1741aacfeebd2a964c30ec32f1460e4b..738a907031ceae6156350e0f3f3e9bf50a1390f8 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -80,6 +80,12 @@ declare_args() {
# of binutils can cause linker warning.
# See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359
fatal_linker_warnings = true
+
+ # AFDO (Automatic Feedback Directed Optimizer) is a form of profile-guided
+ # optimization that GCC supports. It used by ChromeOS in their official
+ # builds. To use it, set auto_profile_path to the path to a file containing
+ # the needed gcov profiling data.
+ auto_profile_path = ""
}
if (is_clang && !is_nacl) {
@@ -1477,6 +1483,18 @@ config("default_optimization") {
}
}
+# GCC supports a form of profile-guided optimization called AFDO, which
+# is used by ChromeOS in their official builds. However,
+# //base/allocator:tcmalloc currently doesn't work correctly with AFDO
+# so we provide separate config so that the flag can be disabled per-target.
+# TODO(crbug.com/633719): Remove this config once tcmalloc works with AFDO
+# or we remove tcmalloc or we stop using AFDO.
+config("afdo") {
+ if (auto_profile_path != "" && current_toolchain == default_toolchain) {
+ cflags = [ "-fauto-profile=${auto_profile_path}" ]
+ }
+}
+
# Symbols ----------------------------------------------------------------------
# The BUILDCONFIG file sets the "default_symbols" config on targets by
« no previous file with comments | « build/config/BUILDCONFIG.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698