- Add llvm-workaround-superfluous-branches.patch: hints LLVM to

eliminate branches until gh#llvm/llvm-project#28804 is solved.

OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm15?expand=0&rev=18
This commit is contained in:
Aaron Puchert 2023-01-19 20:24:57 +00:00 committed by Git OBS Bridge
parent 04d8fe57b7
commit cdc7a41102
3 changed files with 29 additions and 11 deletions

View File

@ -0,0 +1,14 @@
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index b6bbff8..1b68640 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -605,6 +605,9 @@ LLVM_NODISCARD inline decltype(auto) dyn_cast(From &Val) {
template <typename To, typename From>
LLVM_NODISCARD inline decltype(auto) dyn_cast(From *Val) {
+#if defined(__clang__) && defined(NDEBUG)
+ __builtin_assume(Val);
+#endif
return CastInfo<To, From *>::doCastIfPossible(Val);
}

View File

@ -5,11 +5,12 @@ Sat Jan 14 14:06:38 UTC 2023 - Aaron Puchert <aaronpuchert@alice-dsl.net>
* This release contains bug-fixes for the LLVM 15.0.0 release. * This release contains bug-fixes for the LLVM 15.0.0 release.
This release is API and ABI compatible with 15.0.0. This release is API and ABI compatible with 15.0.0.
- Rebase llvm-do-not-install-static-libraries.patch. - Rebase llvm-do-not-install-static-libraries.patch.
- Build stage 2 with -fno-plt if we're using LTO: since building - Build stage 2 with -fno-plt on x86_64: since building with
with -Wl,-z,now the PLT stubs are basically dead code, and -Wl,-z,now the PLT stubs are basically dead code, so eliminating
eliminating the indirection should improve code locality and the indirection reduces the number of branches and improves code
reduce BTB pressure for the quite frequent cross-DSO calls. locality for the quite frequent cross-DSO calls.
With LTO we should not need linker relaxation. - Add llvm-workaround-superfluous-branches.patch: hints LLVM to
eliminate branches until gh#llvm/llvm-project#28804 is solved.
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Dec 4 21:43:38 UTC 2022 - Aaron Puchert <aaronpuchert@alice-dsl.net> Sun Dec 4 21:43:38 UTC 2022 - Aaron Puchert <aaronpuchert@alice-dsl.net>

View File

@ -367,6 +367,8 @@ Patch13: llvm-normally-versioned-libllvm.patch
Patch14: llvm-do-not-install-static-libraries.patch Patch14: llvm-do-not-install-static-libraries.patch
# PATCH-FIX-OPENSUSE (or -UPSTREAM?): we disable RPATHs, but the test driver drops LD_LIBRARY_PATH. # PATCH-FIX-OPENSUSE (or -UPSTREAM?): we disable RPATHs, but the test driver drops LD_LIBRARY_PATH.
Patch15: libcxx-test-library-path.patch Patch15: libcxx-test-library-path.patch
# PATCH-FIX-UPSTREAM (?): Work around gh#llvm/llvm-project#28804 by hinting with __builtin_assume.
Patch16: llvm-workaround-superfluous-branches.patch
Patch20: llvm_build_tablegen_component_as_shared_library.patch Patch20: llvm_build_tablegen_component_as_shared_library.patch
Patch21: tests-use-python3.patch Patch21: tests-use-python3.patch
Patch22: llvm-better-detect-64bit-atomics-support.patch Patch22: llvm-better-detect-64bit-atomics-support.patch
@ -807,6 +809,7 @@ This package contains the development files for Polly.
%patch5 -p1 %patch5 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1 %patch14 -p1
%patch16 -p2
%patch20 -p1 %patch20 -p1
%patch21 -p1 %patch21 -p1
%patch22 -p1 %patch22 -p1
@ -979,12 +982,12 @@ if ! ./stage1/bin/clang -c -xc -Werror -fstack-clash-protection -o /dev/null /de
then then
flags=$(echo -n %flags | sed 's/-fstack-clash-protection//'); flags=$(echo -n %flags | sed 's/-fstack-clash-protection//');
fi fi
# 4) Add -fno-plt: With -Wl,-z,now we don't need the PLT anymore, allowing us to # 4) Add -fno-plt: With -Wl,-z,now the PLT is basically dead code, so we can
# reduce the number of branches for the quite frequent cross-DSO calls. This # now go the direct route for quite frequent cross-DSO calls. This reduces
# is good for code locality and reduces the pressure on the BTB. # branches in a typical execution by ~5 percent, instructions/cycles
# However, do this only when we're using LTO, since otherwise indirect # by ~4 percent, and reduces pressure on the instruction cache. We do this
# branches have to be relaxed by the linker, which might cause regressions. # only on x86_64 where it doesn't increase the code size significantly.
%if %{with thin_lto} %ifarch x86_64
flags="$flags -fno-plt" flags="$flags -fno-plt"
%endif %endif