mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-22 23:07:10 -08:00
sys-devel/gcc: fix two Firefox issues w/ GCC 15
* Fix ICE when building Firefox with PGO (PR118318). The patch isn't yet applied upstream but it's simple and an additional safety-check so shouldn't cause wrong-code (at worst, it's too pessimistic and could hurt performance a bit, rather than anything else). * Fix ICE when building Firefox without -march=XXX combined with LTO (PR119067). I only hit this when building manually without -march=XXX. Never hit it with the ebuild. Bug: https://gcc.gnu.org/PR118318 Bug: https://gcc.gnu.org/PR119067 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f22e89167b3abfbf6d67f42fc4d689d8ffdc1810
|
||||
https://gcc.gnu.org/PR119067
|
||||
|
||||
From f22e89167b3abfbf6d67f42fc4d689d8ffdc1810 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Biener <rguenther@suse.de>
|
||||
Date: Mon, 3 Mar 2025 09:54:15 +0100
|
||||
Subject: [PATCH] ipa/119067 - bogus TYPE_PRECISION check on VECTOR_TYPE
|
||||
|
||||
odr_types_equivalent_p can end up using TYPE_PRECISION on vector
|
||||
types which is a no-go. The following instead uses TYPE_VECTOR_SUBPARTS
|
||||
for vector types so we also end up comparing the number of vector elements.
|
||||
|
||||
PR ipa/119067
|
||||
* ipa-devirt.cc (odr_types_equivalent_p): Check
|
||||
TYPE_VECTOR_SUBPARTS for vectors.
|
||||
|
||||
* g++.dg/lto/pr119067_0.C: New testcase.
|
||||
* g++.dg/lto/pr119067_1.C: Likewise.
|
||||
---
|
||||
gcc/ipa-devirt.cc | 10 +++++++++-
|
||||
gcc/testsuite/g++.dg/lto/pr119067_0.C | 22 ++++++++++++++++++++++
|
||||
gcc/testsuite/g++.dg/lto/pr119067_1.C | 10 ++++++++++
|
||||
3 files changed, 41 insertions(+), 1 deletion(-)
|
||||
create mode 100644 gcc/testsuite/g++.dg/lto/pr119067_0.C
|
||||
create mode 100644 gcc/testsuite/g++.dg/lto/pr119067_1.C
|
||||
|
||||
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
|
||||
index c31658f57ef2..532e25e87c60 100644
|
||||
--- a/gcc/ipa-devirt.cc
|
||||
+++ b/gcc/ipa-devirt.cc
|
||||
@@ -1259,13 +1259,21 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
|
||||
|| TREE_CODE (t1) == OFFSET_TYPE
|
||||
|| POINTER_TYPE_P (t1))
|
||||
{
|
||||
- if (TYPE_PRECISION (t1) != TYPE_PRECISION (t2))
|
||||
+ if (!VECTOR_TYPE_P (t1) && TYPE_PRECISION (t1) != TYPE_PRECISION (t2))
|
||||
{
|
||||
warn_odr (t1, t2, NULL, NULL, warn, warned,
|
||||
G_("a type with different precision is defined "
|
||||
"in another translation unit"));
|
||||
return false;
|
||||
}
|
||||
+ if (VECTOR_TYPE_P (t1)
|
||||
+ && maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2)))
|
||||
+ {
|
||||
+ warn_odr (t1, t2, NULL, NULL, warn, warned,
|
||||
+ G_("a vector type with different number of elements "
|
||||
+ "is defined in another translation unit"));
|
||||
+ return false;
|
||||
+ }
|
||||
if (TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2))
|
||||
{
|
||||
warn_odr (t1, t2, NULL, NULL, warn, warned,
|
||||
diff --git a/gcc/testsuite/g++.dg/lto/pr119067_0.C b/gcc/testsuite/g++.dg/lto/pr119067_0.C
|
||||
new file mode 100644
|
||||
index 000000000000..e0f813ceffed
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/g++.dg/lto/pr119067_0.C
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* { dg-lto-do link } */
|
||||
+/* { dg-skip-if "" { ! { x86_64-*-* i?86-*-* } } } */
|
||||
+/* { dg-require-effective-target avx2 } */
|
||||
+/* { dg-require-effective-target shared } */
|
||||
+/* { dg-lto-options { { -O2 -fPIC -flto } } } */
|
||||
+/* { dg-extra-ld-options { -shared } } */
|
||||
+
|
||||
+#pragma GCC push_options
|
||||
+#pragma GCC target("avx2")
|
||||
+typedef char __v32qi __attribute__ ((__vector_size__ (32)));
|
||||
+struct ff
|
||||
+{
|
||||
+ __v32qi t;
|
||||
+};
|
||||
+__v32qi g(struct ff a);
|
||||
+
|
||||
+__v32qi h(__v32qi a)
|
||||
+{
|
||||
+ struct ff t = {a};
|
||||
+ return g(t);
|
||||
+}
|
||||
+#pragma GCC pop_options
|
||||
diff --git a/gcc/testsuite/g++.dg/lto/pr119067_1.C b/gcc/testsuite/g++.dg/lto/pr119067_1.C
|
||||
new file mode 100644
|
||||
index 000000000000..d8e2935fa24d
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/g++.dg/lto/pr119067_1.C
|
||||
@@ -0,0 +1,10 @@
|
||||
+/* { dg-options "-mavx2" } */
|
||||
+
|
||||
+typedef char __v32qi __attribute__ ((__vector_size__ (32)));
|
||||
+struct ff
|
||||
+{
|
||||
+ __v32qi t;
|
||||
+};
|
||||
+__v32qi g(struct ff a) {
|
||||
+ return a.t;
|
||||
+}
|
||||
--
|
||||
2.43.5
|
||||
@@ -0,0 +1,58 @@
|
||||
https://inbox.sourceware.org/gcc-patches/ri6bjui45il.fsf@virgil.suse.cz/
|
||||
|
||||
From 833d679c3c071b78dfb22015fe03d2cecfd650ec Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <833d679c3c071b78dfb22015fe03d2cecfd650ec.1741019831.git.sam@gentoo.org>
|
||||
From: Martin Jambor <mjambor@suse.cz>
|
||||
Date: Mon, 3 Mar 2025 14:18:10 +0100
|
||||
Subject: [PATCH] ipa-cp: Avoid ICE when redistributing nodes among edges to
|
||||
recursive clones (PR 118318)
|
||||
|
||||
Hi,
|
||||
|
||||
PR 118318 reported an ICE during PGO build of Firefox when IPA-CP, in
|
||||
the final stages of update_counts_for_self_gen_clones where it
|
||||
attempts to guess how to distribute profile count among clones created
|
||||
for recursive edges and the various edges that are created in the
|
||||
process. If one such edge has profile count of kind GUESSED_GLOBAL0,
|
||||
the compatibility check in the operator+ will lead to an ICE. After
|
||||
discussing the situation with Honza, we concluded that there is little
|
||||
more we can do other than check for this situation before touching the
|
||||
edge count, so this is what this patch does.
|
||||
|
||||
Bootstrapped and LTO-profile-bootstrapped and tested on x86_64. OK for
|
||||
master? (Should I then backport this to active release branches? I
|
||||
guess it would make sense.)
|
||||
|
||||
Thanks,
|
||||
|
||||
Martin
|
||||
|
||||
gcc/ChangeLog:
|
||||
|
||||
2025-02-28 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR ipa/118318
|
||||
* ipa-cp.cc (adjust_clone_incoming_counts): Add a compatible_p check.
|
||||
---
|
||||
gcc/ipa-cp.cc | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
|
||||
index 3c994f24f540..264568989a96 100644
|
||||
--- a/gcc/ipa-cp.cc
|
||||
+++ b/gcc/ipa-cp.cc
|
||||
@@ -4638,7 +4638,8 @@ adjust_clone_incoming_counts (cgraph_node *node,
|
||||
cs->count = cs->count.combine_with_ipa_count (sum);
|
||||
}
|
||||
else if (!desc->processed_edges->contains (cs)
|
||||
- && cs->caller->clone_of == desc->orig)
|
||||
+ && cs->caller->clone_of == desc->orig
|
||||
+ && cs->count.compatible_p (desc->count))
|
||||
{
|
||||
cs->count += desc->count;
|
||||
if (dump_file)
|
||||
|
||||
base-commit: f1c30c6213fb228f1e8b5973d10c868b834a4acd
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
TOOLCHAIN_PATCH_DEV="sam"
|
||||
TOOLCHAIN_HAS_TESTS=1
|
||||
PATCH_GCC_VER="15.0.0"
|
||||
PATCH_VER="46"
|
||||
MUSL_VER="2"
|
||||
MUSL_GCC_VER="15.0.0"
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
|
||||
if [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
|
||||
# Cheesy hack for RCs
|
||||
MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 1)))-RC-$(ver_cut 5)
|
||||
MY_P=${PN}-${MY_PV}
|
||||
GCC_TARBALL_SRC_URI="mirror://gcc/snapshots/${MY_PV}/${MY_P}.tar.xz"
|
||||
TOOLCHAIN_SET_S=no
|
||||
S="${WORKDIR}"/${MY_P}
|
||||
fi
|
||||
|
||||
inherit toolchain
|
||||
|
||||
if tc_is_live ; then
|
||||
# Needs to be after inherit (for now?), bug #830908
|
||||
EGIT_BRANCH=master
|
||||
elif [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
|
||||
# Don't keyword live ebuilds
|
||||
#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
:;
|
||||
fi
|
||||
|
||||
if [[ ${CATEGORY} != cross-* ]] ; then
|
||||
# Technically only if USE=hardened *too* right now, but no point in complicating it further.
|
||||
# If GCC is enabling CET by default, we need glibc to be built with support for it.
|
||||
# bug #830454
|
||||
RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
|
||||
DEPEND="${RDEPEND}"
|
||||
fi
|
||||
|
||||
src_prepare() {
|
||||
local p upstreamed_patches=(
|
||||
# add them here
|
||||
)
|
||||
for p in "${upstreamed_patches[@]}"; do
|
||||
rm -v "${WORKDIR}/patch/${p}" || die
|
||||
done
|
||||
|
||||
toolchain_src_prepare
|
||||
eapply "${FILESDIR}"/${P}-firefox-ice.patch
|
||||
eapply "${FILESDIR}"/${P}-firefox-pgo-ice.patch
|
||||
eapply_user
|
||||
}
|
||||
Reference in New Issue
Block a user