From 54969766fd2029c506befc46e9ce14d67c7ed02a Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Tue, 25 Apr 2023 03:05:19 +0000 Subject: [PATCH] Reland [clang] Disable autoupgrading debug info in ThinLTO builds ThinLTO reads bitcode many times and attempts to upgrade the debug info every time. This is expensive since it calls the verifier. We don't need this given all LLVM bitcode producers are from the same version of LLVM. For just the build step that runs ThinLTO and links official Chrome, measured 34T -> 32T instructions via perf stat. Reland disables adding flag for ChromeOS since that toolchain is too old to have this flag. Bug: 972449 Change-Id: I44552dd6c9dc71683c002d0c885e78b2a4341659 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4470209 Reviewed-by: Nico Weber Commit-Queue: Arthur Eubanks Cr-Commit-Position: refs/heads/main@{#1135007} --- build/config/compiler/BUILD.gn | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 1c13bc80f0f..53db095c1b1 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -685,6 +685,7 @@ config("compiler") { "/lldltocache:" + rebase_path("$root_out_dir/thinlto-cache", root_build_dir), "/lldltocachepolicy:$cache_policy", + "-mllvm:-disable-auto-upgrade-debug-info", ] } else { ldflags += [ "-flto=thin" ] @@ -725,6 +726,14 @@ config("compiler") { } ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ] + + if (!is_chromeos) { + # TODO(https://crbug.com/972449): turn on for ChromeOS when that + # toolchain has this flag. + # We only use one version of LLVM within a build so there's no need to + # upgrade debug info, which can be expensive since it runs the verifier. + ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ] + } } # TODO(https://crbug.com/1211155): investigate why this isn't effective on