summarylogtreecommitdiffstats
path: root/REVERT-disable-autoupgrading-debug-info.patch
blob: a60db7ee6d2fd44e79e41cc20a774e0d64bb70e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 54969766fd2029c506befc46e9ce14d67c7ed02a Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks@google.com>
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 <thakis@chromium.org>
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
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