Bug 1801268 - enable lto-built clang r=firefox-build-system-reviewers,glandium

Using ThinLTO because it's a good compromise between performance and
compilation speed.

Activating it for both profile generation and profile usage, doing it
only for profile usage leads to a lot of mismatch, aka

        function control flow change detected (hash mismatch)

which leads to profile information not beoing used.

This requires using the whole llvm toolchain (lld, llvm-ar, llvm-ranlib)
from the same revision.

This is disabled on Windows where it causes link error on the LLVM
Plugin system.

Differential Revision: https://phabricator.services.mozilla.com/D162371
This commit is contained in:
serge-sans-paille
2023-01-25 09:46:40 +00:00
parent 597dd0e03e
commit f3a263c5a4
3 changed files with 12 additions and 2 deletions

View File

@@ -294,6 +294,7 @@ def build_one_stage(
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=%s"
% os.environ["MACOSX_DEPLOYMENT_TARGET"],
]
if profile == "gen":
# Per https://releases.llvm.org/10.0.0/docs/HowToBuildWithPGO.html
cmake_args += [
@@ -304,6 +305,11 @@ def build_one_stage(
cmake_args += [
"-DLLVM_PROFDATA_FILE=%s" % profile,
]
# Using LTO for both profile generation and usage to avoid most
# "function control flow change detected (hash mismatch)" error.
if profile and not is_windows():
cmake_args.append("-DLLVM_ENABLE_LTO=Thin")
return cmake_args
cmake_args = []