Enable PGO/LTO

This commit is contained in:
Martin Stransky 2023-06-22 13:14:14 +02:00
parent 80f05818c3
commit b2c506e3b4
4 changed files with 33 additions and 29 deletions

View File

@ -0,0 +1,14 @@
diff -up firefox-114.0.2/gfx/wr/swgl/src/gl.cc.inline firefox-114.0.2/gfx/wr/swgl/src/gl.cc
--- firefox-114.0.2/gfx/wr/swgl/src/gl.cc.inline 2023-06-22 11:08:53.294593327 +0200
+++ firefox-114.0.2/gfx/wr/swgl/src/gl.cc 2023-06-22 11:12:43.663486734 +0200
@@ -58,9 +58,7 @@ WINBASEAPI BOOL WINAPI QueryPerformanceF
}
#else
-// GCC is slower when dealing with always_inline, especially in debug builds.
-// When using Clang, use always_inline more aggressively.
-# if defined(__clang__) || defined(NDEBUG)
+# if defined(__clang__) || defined (__GNUC__) || defined(NDEBUG)
# define ALWAYS_INLINE __attribute__((always_inline)) inline
# else
# define ALWAYS_INLINE inline

View File

@ -70,8 +70,7 @@ ExcludeArch: ppc64le
%global build_with_pgo 0
%ifarch x86_64
%if %{release_build}
#Disabled PGO build due to rhbz#2136401
%global build_with_pgo 0
%global build_with_pgo 1
%endif
%endif
%if 0%{?flatpak}
@ -158,7 +157,7 @@ ExcludeArch: ppc64le
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 114.0.2
Release: 1%{?pre_tag}%{?dist}
Release: 2%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@ -235,7 +234,7 @@ Patch407: mozilla-1667096.patch
# PGO/LTO patches
Patch600: pgo.patch
Patch602: mozilla-1516803.patch
Patch603: firefox-gcc-always-inline.patch
# tentative patch for RUSTFLAGS parsing issue:
# https://bugzilla.redhat.com/show_bug.cgi?id=2184743
@ -508,9 +507,9 @@ This package contains results of tests executed during build.
%if %{build_with_pgo}
%if !%{build_with_clang}
%patch600 -p1 -b .pgo
%patch602 -p1 -b .1516803
%endif
%endif
%patch603 -p1 -b .inline
%patch1200 -p1 -b .rustflags-commasplit
@ -1042,6 +1041,9 @@ fi
#---------------------------------------------------------------------
%changelog
* Thu Jun 22 2023 Martin Stransky <stransky@redhat.com>- 114.0.2-2
- Enable PGO/LTO again.
* Tue Jun 20 2023 Martin Stransky <stransky@redhat.com>- 114.0.2-1
- Update to 114.0.2

View File

@ -1,15 +0,0 @@
diff -up firefox-84.0/security/sandbox/linux/moz.build.1516803 firefox-84.0/security/sandbox/linux/moz.build
--- firefox-84.0/security/sandbox/linux/moz.build.1516803 2020-12-10 16:17:55.425139545 +0100
+++ firefox-84.0/security/sandbox/linux/moz.build 2020-12-10 16:29:21.945860841 +0100
@@ -114,9 +114,8 @@ if CONFIG["CC_TYPE"] in ("clang", "gcc")
# gcc lto likes to put the top level asm in syscall.cc in a different partition
# from the function using it which breaks the build. Work around that by
# forcing there to be only one partition.
-for f in CONFIG["OS_CXXFLAGS"]:
- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
- LDFLAGS += ["--param lto-partitions=1"]
+if CONFIG['CC_TYPE'] != 'clang':
+ LDFLAGS += ['--param', 'lto-partitions=1']
DEFINES["NS_NO_XPCOM"] = True
DisableStlWrapping()

View File

@ -89,15 +89,6 @@ diff -up firefox-112.0/build/unix/mozconfig.unix.pgo firefox-112.0/build/unix/mo
# We want to make sure we use binutils and other binaries in the tooltool
# package.
mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$MOZ_FETCHES_DIR/binutils/bin:$PATH"
diff -up firefox-112.0/extensions/spellcheck/src/moz.build.pgo firefox-112.0/extensions/spellcheck/src/moz.build
--- firefox-112.0/extensions/spellcheck/src/moz.build.pgo 2023-04-06 17:27:41.000000000 +0200
+++ firefox-112.0/extensions/spellcheck/src/moz.build 2023-04-06 21:27:32.537089073 +0200
@@ -28,3 +28,5 @@ EXPORTS.mozilla += [
"mozInlineSpellChecker.h",
"mozSpellChecker.h",
]
+
+CXXFLAGS += ['-fno-devirtualize']
diff -up firefox-112.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-112.0/toolkit/components/terminator/nsTerminator.cpp
--- firefox-112.0/toolkit/components/terminator/nsTerminator.cpp.pgo 2023-04-06 17:27:57.000000000 +0200
+++ firefox-112.0/toolkit/components/terminator/nsTerminator.cpp 2023-04-06 21:27:32.538089108 +0200
@ -113,3 +104,15 @@ diff -up firefox-112.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefo
UniquePtr<Options> options(new Options());
// crashAfterTicks is guaranteed to be > 0 as
// crashAfterMS >= ADDITIONAL_WAIT_BEFORE_CRASH_MS >> HEARTBEAT_INTERVAL_MS
diff -up firefox-114.0.2/build/moz.configure/lto-pgo.configure.pgo firefox-114.0.2/build/moz.configure/lto-pgo.configure
--- firefox-114.0.2/build/moz.configure/lto-pgo.configure.pgo 2023-06-22 11:17:37.428552356 +0200
+++ firefox-114.0.2/build/moz.configure/lto-pgo.configure 2023-06-22 11:17:51.476033691 +0200
@@ -86,7 +86,7 @@ def pgo_flags(compiler, profdata, target
return namespace(
gen_cflags=["-fprofile-generate"],
gen_ldflags=["-fprofile-generate"],
- use_cflags=["-fprofile-use", "-fprofile-correction", "-Wcoverage-mismatch"],
+ use_cflags=["-fprofile-use", "-fprofile-correction", "-Wno-coverage-mismatch"],
use_ldflags=["-fprofile-use"],
)