11.4.1-2.2
Guard the bit test merging code in if-combine https://issues.redhat.com/browse/RHEL-6068
This commit is contained in:
parent
d21140fb6c
commit
1f57f26786
9
gcc.spec
9
gcc.spec
@ -128,7 +128,7 @@
|
||||
Summary: Various compilers (C, C++, Objective-C, ...)
|
||||
Name: gcc
|
||||
Version: %{gcc_version}
|
||||
Release: %{gcc_release}.1%{?dist}
|
||||
Release: %{gcc_release}.2%{?dist}
|
||||
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
|
||||
# GCC Runtime Exception.
|
||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
||||
@ -293,6 +293,8 @@ Patch29: gcc11-s390x-regarg-3.patch
|
||||
Patch30: gcc11-testsuite-fixes.patch
|
||||
Patch31: gcc11-pr96024.patch
|
||||
Patch32: gcc11-testsuite-fixes-2.patch
|
||||
Patch33: gcc11-pr111039.patch
|
||||
Patch34: gcc11-pr111070.patch
|
||||
|
||||
Patch100: gcc11-fortran-fdec-duplicates.patch
|
||||
Patch101: gcc11-fortran-flogical-as-integer.patch
|
||||
@ -891,6 +893,8 @@ mark them as cross compiled.
|
||||
%patch30 -p1 -b .testsuite~
|
||||
%patch31 -p1 -b .pr96024~
|
||||
%patch32 -p1 -b .testsuite2~
|
||||
%patch33 -p1 -b .pr111039~
|
||||
%patch34 -p1 -b .pr111070~
|
||||
|
||||
%if 0%{?rhel} >= 9
|
||||
%patch100 -p1 -b .fortran-fdec-duplicates~
|
||||
@ -3584,6 +3588,9 @@ end
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Oct 2 2023 Marek Polacek <polacek@redhat.com> 11.4.1-2.2
|
||||
- guard the bit test merging code in if-combine (RHEL-6068)
|
||||
|
||||
* Fri Jun 9 2023 Marek Polacek <polacek@redhat.com> 11.4.1-2.1
|
||||
- fix ICE on pr96024.f90 on big-endian hosts (PR fortran/96024, #2213211)
|
||||
- use -fno-stack-protector to fix bit-field aarch64 tests (#2213221)
|
||||
|
61
gcc11-pr111039.patch
Normal file
61
gcc11-pr111039.patch
Normal file
@ -0,0 +1,61 @@
|
||||
commit 482551a79a3d3f107f6239679ee74655cfe8707e
|
||||
Author: Richard Biener <rguenther@suse.de>
|
||||
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.
|
||||
|
||||
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();
|
||||
+}
|
||||
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
|
||||
index 58e19c1508e..d5701e8c407 100644
|
||||
--- a/gcc/tree-ssa-ifcombine.cc
|
||||
+++ b/gcc/tree-ssa-ifcombine.cc
|
||||
@@ -430,6 +430,9 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
|
||||
{
|
||||
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),
|
||||
@@ -486,6 +489,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))
|
||||
+ return false;
|
||||
+
|
||||
/* Find the common name which is bit-tested. */
|
||||
if (name1 == name2)
|
||||
;
|
68
gcc11-pr111070.patch
Normal file
68
gcc11-pr111070.patch
Normal file
@ -0,0 +1,68 @@
|
||||
commit 966b0a96523fb7adbf498ac71df5e033c70dc546
|
||||
Author: Richard Biener <rguenther@suse.de>
|
||||
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.
|
||||
|
||||
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;
|
||||
+}
|
||||
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
|
||||
index d5701e8c407..46b076804f4 100644
|
||||
--- a/gcc/tree-ssa-ifcombine.cc
|
||||
+++ b/gcc/tree-ssa-ifcombine.cc
|
||||
@@ -430,7 +430,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. */
|
||||
@@ -489,8 +490,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. */
|
Loading…
Reference in New Issue
Block a user