From 4897f662d8cbbb0934ad83a21773edf731b3a256 Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Tue, 26 Nov 2024 21:54:52 -0600 Subject: [PATCH] polly and bolt fixes --- args.gn | 2 +- arm/build/config/compiler/BUILD.gn | 35 +++++++++++++++++++++--------- other/AVX2/AVX2_args.gn | 2 +- other/AVX512/AVX512_args.gn | 2 +- other/SSE3/args_SSE3.gn | 2 +- other/SSE4.1/args_SSE4.1.gn | 2 +- other/SSE4.2/args_SSE4.2.gn | 2 +- src/build/config/compiler/BUILD.gn | 35 +++++++++++++++++++++--------- src/tools/clang/scripts/build.py | 4 +--- 9 files changed, 57 insertions(+), 29 deletions(-) diff --git a/args.gn b/args.gn index 68a8159a..84487ffb 100644 --- a/args.gn +++ b/args.gn @@ -87,4 +87,4 @@ enable_rust = true enable_all_rust_features = true init_stack_vars_zero = true chrome_pgo_phase = 2 -pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732295315-c40887b1918f8e01bfcd937f2f416b7fffac2252-74da9411216ab49f72b5ea57c6e907e5cf436f73.profdata" +pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732380281-628a3b15abb0d91eb54d4f580a0201950ef6f42f-1d82f3f10d1e206a7d99e1b5122a997bec34666a.profdata" diff --git a/arm/build/config/compiler/BUILD.gn b/arm/build/config/compiler/BUILD.gn index 23068b73..2e0cfdf6 100644 --- a/arm/build/config/compiler/BUILD.gn +++ b/arm/build/config/compiler/BUILD.gn @@ -266,6 +266,21 @@ config("no_unresolved_symbols") { } } +# Emit relocations for BOLT +config("emit-relocs") { + if (!using_sanitizer && use_bolt) { + if (is_win) { + ldflags = [ + "-mllvm:--emit-relocs", + ] + } else { + ldflags = [ + "-Wl,--emit-relocs", + ] + } + } +} + # compiler --------------------------------------------------------------------- # # Base compiler configuration. @@ -2629,11 +2644,11 @@ if (is_win) { if (use_polly == true) { common_optimize_on_ldflags += [ - "-mllvm:-polly", - "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", - "-mllvm:-polly-invariant-load-hoisting", - "-mllvm:-polly-run-dce", - "-mllvm:-polly-vectorizer=stripmine", + "-mllvm:-polly", + "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", + #"-mllvm:-polly-invariant-load-hoisting", + "-mllvm:-polly-run-dce", + "-mllvm:-polly-vectorizer=stripmine", ] } @@ -2772,11 +2787,11 @@ if (is_win) { if (use_polly == true) { common_optimize_on_ldflags += [ - "-Wl,-mllvm,-polly", - "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", - "-Wl,-mllvm,-polly-invariant-load-hoisting", - "-Wl,-mllvm,-polly-run-dce", - "-Wl,-mllvm,-polly-vectorizer=stripmine", + "-Wl,-mllvm,-polly", + "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", + #"-Wl,-mllvm,-polly-invariant-load-hoisting", + "-Wl,-mllvm,-polly-run-dce", + "-Wl,-mllvm,-polly-vectorizer=stripmine", ] } diff --git a/other/AVX2/AVX2_args.gn b/other/AVX2/AVX2_args.gn index acb1399a..f1444f3e 100644 --- a/other/AVX2/AVX2_args.gn +++ b/other/AVX2/AVX2_args.gn @@ -87,4 +87,4 @@ enable_rust = true enable_all_rust_features = true init_stack_vars_zero = true chrome_pgo_phase = 2 -pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732295315-c40887b1918f8e01bfcd937f2f416b7fffac2252-74da9411216ab49f72b5ea57c6e907e5cf436f73.profdata" +pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732380281-628a3b15abb0d91eb54d4f580a0201950ef6f42f-1d82f3f10d1e206a7d99e1b5122a997bec34666a.profdata" diff --git a/other/AVX512/AVX512_args.gn b/other/AVX512/AVX512_args.gn index afdf42d5..2bc36efc 100644 --- a/other/AVX512/AVX512_args.gn +++ b/other/AVX512/AVX512_args.gn @@ -87,4 +87,4 @@ enable_rust = true enable_all_rust_features = true init_stack_vars_zero = true chrome_pgo_phase = 2 -pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732295315-c40887b1918f8e01bfcd937f2f416b7fffac2252-74da9411216ab49f72b5ea57c6e907e5cf436f73.profdata" +pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732380281-628a3b15abb0d91eb54d4f580a0201950ef6f42f-1d82f3f10d1e206a7d99e1b5122a997bec34666a.profdata" diff --git a/other/SSE3/args_SSE3.gn b/other/SSE3/args_SSE3.gn index 121fe876..c2b220d2 100644 --- a/other/SSE3/args_SSE3.gn +++ b/other/SSE3/args_SSE3.gn @@ -87,4 +87,4 @@ enable_rust = true enable_all_rust_features = true init_stack_vars_zero = true chrome_pgo_phase = 2 -pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732295315-c40887b1918f8e01bfcd937f2f416b7fffac2252-74da9411216ab49f72b5ea57c6e907e5cf436f73.profdata" +pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732380281-628a3b15abb0d91eb54d4f580a0201950ef6f42f-1d82f3f10d1e206a7d99e1b5122a997bec34666a.profdata" diff --git a/other/SSE4.1/args_SSE4.1.gn b/other/SSE4.1/args_SSE4.1.gn index 76a28526..7515349d 100644 --- a/other/SSE4.1/args_SSE4.1.gn +++ b/other/SSE4.1/args_SSE4.1.gn @@ -87,4 +87,4 @@ enable_rust = true enable_all_rust_features = true init_stack_vars_zero = true chrome_pgo_phase = 2 -pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732295315-c40887b1918f8e01bfcd937f2f416b7fffac2252-74da9411216ab49f72b5ea57c6e907e5cf436f73.profdata" +pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732380281-628a3b15abb0d91eb54d4f580a0201950ef6f42f-1d82f3f10d1e206a7d99e1b5122a997bec34666a.profdata" diff --git a/other/SSE4.2/args_SSE4.2.gn b/other/SSE4.2/args_SSE4.2.gn index 751c5ca5..635ae4b1 100644 --- a/other/SSE4.2/args_SSE4.2.gn +++ b/other/SSE4.2/args_SSE4.2.gn @@ -87,4 +87,4 @@ enable_rust = true enable_all_rust_features = true init_stack_vars_zero = true chrome_pgo_phase = 2 -pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732295315-c40887b1918f8e01bfcd937f2f416b7fffac2252-74da9411216ab49f72b5ea57c6e907e5cf436f73.profdata" +pgo_data_path = "/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-6723-1732380281-628a3b15abb0d91eb54d4f580a0201950ef6f42f-1d82f3f10d1e206a7d99e1b5122a997bec34666a.profdata" diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index 23068b73..2e0cfdf6 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -266,6 +266,21 @@ config("no_unresolved_symbols") { } } +# Emit relocations for BOLT +config("emit-relocs") { + if (!using_sanitizer && use_bolt) { + if (is_win) { + ldflags = [ + "-mllvm:--emit-relocs", + ] + } else { + ldflags = [ + "-Wl,--emit-relocs", + ] + } + } +} + # compiler --------------------------------------------------------------------- # # Base compiler configuration. @@ -2629,11 +2644,11 @@ if (is_win) { if (use_polly == true) { common_optimize_on_ldflags += [ - "-mllvm:-polly", - "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", - "-mllvm:-polly-invariant-load-hoisting", - "-mllvm:-polly-run-dce", - "-mllvm:-polly-vectorizer=stripmine", + "-mllvm:-polly", + "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", + #"-mllvm:-polly-invariant-load-hoisting", + "-mllvm:-polly-run-dce", + "-mllvm:-polly-vectorizer=stripmine", ] } @@ -2772,11 +2787,11 @@ if (is_win) { if (use_polly == true) { common_optimize_on_ldflags += [ - "-Wl,-mllvm,-polly", - "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", - "-Wl,-mllvm,-polly-invariant-load-hoisting", - "-Wl,-mllvm,-polly-run-dce", - "-Wl,-mllvm,-polly-vectorizer=stripmine", + "-Wl,-mllvm,-polly", + "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", + #"-Wl,-mllvm,-polly-invariant-load-hoisting", + "-Wl,-mllvm,-polly-run-dce", + "-Wl,-mllvm,-polly-vectorizer=stripmine", ] } diff --git a/src/tools/clang/scripts/build.py b/src/tools/clang/scripts/build.py index 712be350..b7ab5753 100755 --- a/src/tools/clang/scripts/build.py +++ b/src/tools/clang/scripts/build.py @@ -776,9 +776,7 @@ def main(): ldflags = [] targets = 'AArch64;ARM;LoongArch;Mips;PowerPC;RISCV;SystemZ;WebAssembly;X86' - projects = 'clang;lld;clang-tools-extra;polly' - if args.bolt: - projects += ';bolt' + projects = 'clang;lld;clang-tools-extra;polly;bolt' pic_default = sys.platform == 'win32' pic_mode = 'ON' if args.pic or pic_default else 'OFF'