commit:     d2d84f5c5270a36f190fdb9925809ace48a3f88c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 23 15:21:36 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 23 15:22:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2d84f5c

sys-devel/gcc: add 15.0.0_pre20240922-r1

Has the patch (not yet merged upstream) I mentioned earlier in
24a912568998dbaafab500dee1b478db940fe9a7.

Some weeks it's very quiet, some it's adventurous, but that's the game :)

Bug: https://gcc.gnu.org/PR116817
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...check-explicitly-for-external-or-constant.patch | 93 ++++++++++++++++++++++
 sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild     | 57 +++++++++++++
 2 files changed, 150 insertions(+)

diff --git 
a/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
 
b/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
new file mode 100644
index 000000000000..6dcc1a46c96a
--- /dev/null
+++ 
b/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
@@ -0,0 +1,93 @@
+https://inbox.sourceware.org/gcc-patches/[email protected]/T/#u
+https://gcc.gnu.org/PR116817
+
+From 9a5d1eb943dcaf26551b534eb62cbf1dd8443335 Mon Sep 17 00:00:00 2001
+Message-ID: 
<9a5d1eb943dcaf26551b534eb62cbf1dd8443335.1727104663.git....@gentoo.org>
+From: Tamar Christina <[email protected]>
+Date: Mon, 23 Sep 2024 15:29:52 +0100
+Subject: [PATCH] middle-end: check explicitly for external or constants when
+ checking for loop invariant [PR116817]
+
+Hi All,
+
+The previous check if a value was external was checking
+!vect_get_internal_def (vinfo, var) but this of course isn't completely right
+as they could reductions etc.
+
+This changes the check to just explicitly look at externals and constants.
+Note that reductions remain unhandled here, but we don't support codegen of
+boolean reductions today anyway.
+
+So at the time we do then this would have the be handled as well in lowering.
+
+Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
+
+Ok for master?
+
+Thanks,
+Tamar
+
+gcc/ChangeLog:
+
+       PR tree-optimization/116817
+       * tree-vect-patterns.cc (vect_recog_bool_pattern): Check for const or
+       externals.
+
+gcc/testsuite/ChangeLog:
+
+PR tree-optimization/116817
+       * g++.dg/vect/pr116817.cc: New test.
+---
+ gcc/testsuite/g++.dg/vect/pr116817.cc | 16 ++++++++++++++++
+ gcc/tree-vect-patterns.cc             |  5 ++++-
+ 2 files changed, 20 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/g++.dg/vect/pr116817.cc
+
+diff --git a/gcc/testsuite/g++.dg/vect/pr116817.cc 
b/gcc/testsuite/g++.dg/vect/pr116817.cc
+new file mode 100644
+index 00000000000..7e28982fb13
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/vect/pr116817.cc
+@@ -0,0 +1,16 @@
++/* { dg-do compile } */
++/* { dg-additional-options "-O3" } */
++
++int main_ulData0;
++unsigned *main_pSrcBuffer;
++int main(void) {
++  int iSrc = 0;
++  bool bData0;
++  for (; iSrc < 4; iSrc++) {
++    if (bData0)
++      main_pSrcBuffer[iSrc] = main_ulData0;
++    else
++      main_pSrcBuffer[iSrc] = 0;
++    bData0 = !bData0;
++  }
++}
+diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
+index e7e877dd2ad..b913d6de003 100644
+--- a/gcc/tree-vect-patterns.cc
++++ b/gcc/tree-vect-patterns.cc
+@@ -6062,12 +6062,15 @@ vect_recog_bool_pattern (vec_info *vinfo,
+       if (get_vectype_for_scalar_type (vinfo, type) == NULL_TREE)
+       return NULL;
+ 
++      stmt_vec_info var_def_info = vinfo->lookup_def (var);
+       if (check_bool_pattern (var, vinfo, bool_stmts))
+       var = adjust_bool_stmts (vinfo, bool_stmts, type, stmt_vinfo);
+       else if (integer_type_for_mask (var, vinfo))
+       return NULL;
+       else if (TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE
+-             && !vect_get_internal_def (vinfo, var))
++             && var_def_info
++             && (STMT_VINFO_DEF_TYPE (var_def_info) == vect_external_def
++                 || STMT_VINFO_DEF_TYPE (var_def_info) == vect_constant_def))
+       {
+         /* If the condition is already a boolean then manually convert it to a
+            mask of the given integer type but don't set a vectype.  */
+
+base-commit: 358db2e3ed4acf44282d1d9ebbc4a1a3b6e38d21
+-- 
+2.46.1
+

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild 
b/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild
new file mode 100644
index 000000000000..de217fae9b75
--- /dev/null
+++ b/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2024 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="12"
+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
+
+SRC_URI+=" 
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/gcc-15-20240922-rollup-patches.tar.xz";
+
+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 "${WORKDIR}"/gcc-15-20240922-rollup-patches
+       eapply 
"${FILESDIR}"/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
+       eapply_user
+}

Reply via email to