From 783128136c6d10393401e6c5dfacd2fa4ee942b1 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 22 May 2024 13:44:47 +0000 Subject: [PATCH] import CS gcc-8.5.0-22.el8 --- SOURCES/gcc8-RHEL-32886.patch | 59 ++++++++++++++++++++++++++++++ SOURCES/gcc8-pr111039.patch | 61 +++++++++++++++++++++++++++++++ SOURCES/gcc8-pr111070.patch | 68 +++++++++++++++++++++++++++++++++++ SPECS/gcc.spec | 14 +++++++- 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 SOURCES/gcc8-RHEL-32886.patch create mode 100644 SOURCES/gcc8-pr111039.patch create mode 100644 SOURCES/gcc8-pr111070.patch diff --git a/SOURCES/gcc8-RHEL-32886.patch b/SOURCES/gcc8-RHEL-32886.patch new file mode 100644 index 0000000..5ba9026 --- /dev/null +++ b/SOURCES/gcc8-RHEL-32886.patch @@ -0,0 +1,59 @@ +2024-04-18 Jakub Jelinek + + * tree-vect-stmts.c (vectorizable_call): For j == 0 use + vargs.safe_grow (nargs) rather than vargs.create (nargs), for j != 0 + remove vargs.truncate (0). Instead of vargs.quick_push store into + vargs[i]. Use vargs[i] instead of gimple_call_arg (new_stmt, i) + if j != 0. + + * gcc.c-torture/compile/20240418.c: New test. + +--- gcc/tree-vect-stmts.c.jj 2021-04-22 15:48:48.228178359 +0200 ++++ gcc/tree-vect-stmts.c 2024-04-18 13:21:46.104061529 +0200 +@@ -3242,9 +3242,7 @@ vectorizable_call (gimple *gs, gimple_st + { + /* Build argument list for the vectorized call. */ + if (j == 0) +- vargs.create (nargs); +- else +- vargs.truncate (0); ++ vargs.safe_grow (nargs); + + if (slp_node) + { +@@ -3252,7 +3250,7 @@ vectorizable_call (gimple *gs, gimple_st + vec vec_oprnds0; + + for (i = 0; i < nargs; i++) +- vargs.quick_push (gimple_call_arg (stmt, i)); ++ vargs[i] = gimple_call_arg (stmt, i); + vect_get_slp_defs (vargs, slp_node, &vec_defs); + vec_oprnds0 = vec_defs[0]; + +@@ -3314,13 +3312,10 @@ vectorizable_call (gimple *gs, gimple_st + vec_oprnd0 + = vect_get_vec_def_for_operand (op, stmt); + else +- { +- vec_oprnd0 = gimple_call_arg (new_stmt, i); +- vec_oprnd0 +- = vect_get_vec_def_for_stmt_copy (dt[i], vec_oprnd0); +- } ++ vec_oprnd0 ++ = vect_get_vec_def_for_stmt_copy (dt[i], vargs[i]); + +- vargs.quick_push (vec_oprnd0); ++ vargs[i] = vec_oprnd0; + } + + if (gimple_call_internal_p (stmt) +--- gcc/testsuite/gcc.c-torture/compile/20240418.c.jj 2024-04-18 13:24:10.180065661 +0200 ++++ gcc/testsuite/gcc.c-torture/compile/20240418.c 2024-04-18 13:19:12.166194018 +0200 +@@ -0,0 +1,7 @@ ++void ++foo (signed char *p, unsigned long long *q) ++{ ++ int i; ++ for (i = 0; i <= 64; i++) ++ *p++ = __builtin_popcountll (*q++); ++} diff --git a/SOURCES/gcc8-pr111039.patch b/SOURCES/gcc8-pr111039.patch new file mode 100644 index 0000000..1dbd97c --- /dev/null +++ b/SOURCES/gcc8-pr111039.patch @@ -0,0 +1,61 @@ +commit e150cbf591759af10f3d57acbe0eb381aafa00de +Author: Richard Biener +Date: Thu Aug 17 13:10:14 2023 +0200 + + tree-optimization/111039 - abnormals and bit test merging + + The following guards the bit test merging code in if-combine against + the appearance of SSA names used in abnormal PHIs. + + PR tree-optimization/111039 + * tree-ssa-ifcombine.cc (ifcombine_ifandif): Check for + SSA_NAME_OCCURS_IN_ABNORMAL_PHI. + + * gcc.dg/pr111039.c: New testcase. + + (cherry picked from commit 482551a79a3d3f107f6239679ee74655cfe8707e) + +diff --git a/gcc/testsuite/gcc.dg/pr111039.c b/gcc/testsuite/gcc.dg/pr111039.c +new file mode 100644 +index 00000000000..bec9983b35f +--- /dev/null ++++ b/gcc/testsuite/gcc.dg/pr111039.c +@@ -0,0 +1,15 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O" } */ ++ ++int _setjmp (); ++void abcd (); ++void abcde (); ++void compiler_corruption_function(int flags) ++{ ++ int nowait = flags & 1048576, isexpand = flags & 8388608; ++ abcd(); ++ _setjmp(flags); ++ if (nowait && isexpand) ++ flags &= 0; ++ abcde(); ++} +--- a/gcc/tree-ssa-ifcombine.c ++++ b/gcc/tree-ssa-ifcombine.c +@@ -407,6 +407,9 @@ ifcombine_ifandif (basic_block inner_con + { + tree t, t2; + ++ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)) ++ return false; ++ + /* Do it. */ + gsi = gsi_for_stmt (inner_cond); + t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1), +@@ -457,6 +460,10 @@ ifcombine_ifandif (basic_block inner_con + gimple_stmt_iterator gsi; + tree t; + ++ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1) ++ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2)) ++ return false; ++ + /* Find the common name which is bit-tested. */ + if (name1 == name2) + ; diff --git a/SOURCES/gcc8-pr111070.patch b/SOURCES/gcc8-pr111070.patch new file mode 100644 index 0000000..37b2546 --- /dev/null +++ b/SOURCES/gcc8-pr111070.patch @@ -0,0 +1,68 @@ +commit ad42dcf501e41713047cf6c47cbb1dd9f01088a4 +Author: Richard Biener +Date: Mon Aug 21 09:01:00 2023 +0200 + + tree-optimization/111070 - fix ICE with recent ifcombine fix + + We now got test coverage for non-SSA name bits so the following amends + the SSA_NAME_OCCURS_IN_ABNORMAL_PHI checks. + + PR tree-optimization/111070 + * tree-ssa-ifcombine.cc (ifcombine_ifandif): Check we have + an SSA name before checking SSA_NAME_OCCURS_IN_ABNORMAL_PHI. + + * gcc.dg/pr111070.c: New testcase. + + (cherry picked from commit 966b0a96523fb7adbf498ac71df5e033c70dc546) + +diff --git a/gcc/testsuite/gcc.dg/pr111070.c b/gcc/testsuite/gcc.dg/pr111070.c +new file mode 100644 +index 00000000000..1ebc7adf782 +--- /dev/null ++++ b/gcc/testsuite/gcc.dg/pr111070.c +@@ -0,0 +1,20 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O" } */ ++ ++/* common */ ++char c; ++/* arrays must be 8 byte aligned, regardless of size */ ++char c_ary[1]; ++ ++/* data */ ++char d = 1; ++char d_ary[1] = {1}; ++ ++int main () ++{ ++ if (((unsigned long)&c_ary[0] & 7) != 0) ++ return 1; ++ if (((unsigned long)&d_ary[0] & 7) != 0) ++ return 1; ++ return 0; ++} +--- a/gcc/tree-ssa-ifcombine.c ++++ b/gcc/tree-ssa-ifcombine.c +@@ -436,7 +436,8 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv, + { + tree t, t2; + +- if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)) ++ if (TREE_CODE (name1) == SSA_NAME ++ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)) + return false; + + /* Do it. */ +@@ -495,8 +496,10 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv, + gimple_stmt_iterator gsi; + tree t; + +- if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1) +- || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2)) ++ if ((TREE_CODE (name1) == SSA_NAME ++ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name1)) ++ || (TREE_CODE (name2) == SSA_NAME ++ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name2))) + return false; + + /* Find the common name which is bit-tested. */ diff --git a/SPECS/gcc.spec b/SPECS/gcc.spec index 5e7a29e..333af3d 100644 --- a/SPECS/gcc.spec +++ b/SPECS/gcc.spec @@ -4,7 +4,7 @@ %global gcc_major 8 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 20 +%global gcc_release 22 %global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f %global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24 %global _unpackaged_files_terminate_build 0 @@ -304,6 +304,9 @@ Patch43: gcc8-s390x-regarg-3.patch Patch44: gcc8-rh2213753.patch Patch45: gcc8-pr99074.patch Patch46: gcc8-pr87723.patch +Patch47: gcc8-pr111039.patch +Patch48: gcc8-pr111070.patch +Patch49: gcc8-RHEL-32886.patch Patch1000: nvptx-tools-no-ptxas.patch Patch1001: nvptx-tools-build.patch @@ -925,6 +928,9 @@ so that there cannot be any synchronization problems. %patch44 -p1 -b .rh2213753~ %patch45 -p1 -b .pr99074~ %patch46 -p1 -b .pr87723~ +%patch47 -p1 -b .pr111039~ +%patch48 -p1 -b .pr111070~ +%patch49 -p0 -b .32886~ cd nvptx-tools-%{nvptx_tools_gitrev} %patch1000 -p1 -b .nvptx-tools-no-ptxas~ @@ -3332,6 +3338,12 @@ fi %{ANNOBIN_GCC_PLUGIN_DIR}/gcc-annobin.so.0.0.0 %changelog +* Thu Apr 18 2024 Marek Polacek 8.5.0-22 +- fix ICE in the vectorizer (RHEL-32886) + +* Wed Oct 4 2023 Marek Polacek 8.5.0-21 +- guard the bit test merging code in if-combine (RHEL-11483) + * Wed Jun 14 2023 Marek Polacek 8.5.0-20 - fix for TLSLD references (#2213753) - fix crash in dynamic_cast<>() on null pointer (PR c++/99074, #2211506)