!242 [sync] PR-235: [Sync] Sync patch from openeuler/gcc

From: @openeuler-sync-bot 
Reviewed-by: @li-yancheng 
Signed-off-by: @li-yancheng
This commit is contained in:
openeuler-ci-bot 2023-01-06 02:50:11 +00:00 committed by Gitee
commit 3cc9a52f06
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 153 additions and 1 deletions

View File

@ -0,0 +1,58 @@
From d73cd8783ca930724def3e9909fc484ec15404f5 Mon Sep 17 00:00:00 2001
From: benniaobufeijiushiji <linda7@huawei.com>
Date: Mon, 19 Dec 2022 11:48:12 +0800
Subject: [PATCH 1/3] [loop-distribution] Bugfix for loop-distribution Add
exception in function BUILD_QUEUE when there is a null pointer in
grouped_loads.
---
gcc/tree-loop-distribution.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 88b56379c..b68b9c7eb 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -3208,16 +3208,31 @@ build_queue (loop_vec_info vinfo, unsigned vf,
{
unsigned group_size = stmt_info->size;
stmt_vec_info c_stmt_info = stmt_info;
+ bool succ = true;
while (group_size >= vf)
{
vec_alloc (worklist, vf);
for (unsigned j = 0; j < vf; ++j)
{
+ if (c_stmt_info == NULL)
+ {
+ succ = false;
+ break;
+ }
ginfo = new _group_info ();
ginfo->stmt = c_stmt_info->stmt;
worklist->safe_push (ginfo);
c_stmt_info = c_stmt_info->next_element;
}
+ if (!succ)
+ {
+ unsigned k = 0;
+ ginfo = NULL;
+ FOR_EACH_VEC_ELT (*worklist, k, ginfo)
+ delete ginfo;
+ vec_free (worklist);
+ break;
+ }
worklists.safe_push (worklist);
group_size -= vf;
}
@@ -3711,6 +3726,7 @@ free_ginfos (vec<vec<group_info> *> &worklists)
unsigned j = 0;
FOR_EACH_VEC_ELT (*worklist, j, ginfo)
delete ginfo;
+ vec_free (worklist);
}
}
--
2.27.0.windows.1

View File

@ -0,0 +1,26 @@
From b2b710238e13eb2fced77d89cd8dcc86f77b6c6c Mon Sep 17 00:00:00 2001
From: benniaobufeijiushiji <linda7@huawei.com>
Date: Mon, 19 Dec 2022 15:12:24 +0800
Subject: [PATCH 2/3] [semi-relayout] Bugfix for struct semi-relayout Bugfix
when relayout candidate type is null.
---
gcc/ipa-struct-reorg/ipa-struct-reorg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/ipa-struct-reorg/ipa-struct-reorg.c b/gcc/ipa-struct-reorg/ipa-struct-reorg.c
index 4751711fe..2cac340c7 100644
--- a/gcc/ipa-struct-reorg/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg/ipa-struct-reorg.c
@@ -6408,6 +6408,8 @@ ipa_struct_reorg::is_semi_relayout_candidate (tree xhs)
{
tree type = TREE_TYPE (mem);
srtype *old_type = get_relayout_candidate_type (type);
+ if (!old_type)
+ return false;
if (types_compatible_p (type, old_type->type)
&& old_type->semi_relayout)
return true;
--
2.27.0.windows.1

View File

@ -0,0 +1,55 @@
From ae15300352b0fa47a533af852f88e7244c2820cc Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Tue, 29 Sep 2020 14:38:06 +0200
Subject: [PATCH 3/3] [Backport] tree-optimization/97238 - fix typo causing ICE
Reference: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=29aef377d814bd342dd5a306f99e0d614623ce0e
This fixes a typo causing a NULL dereference.
2020-09-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/97238
* tree-ssa-reassoc.c (ovce_extract_ops): Fix typo.
* gcc.dg/pr97238.c: New testcase.
---
gcc/testsuite/gcc.dg/pr97238.c | 12 ++++++++++++
gcc/tree-ssa-reassoc.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/pr97238.c
diff --git a/gcc/testsuite/gcc.dg/pr97238.c b/gcc/testsuite/gcc.dg/pr97238.c
new file mode 100644
index 000000000..746e93a97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97238.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wno-psabi -w" } */
+
+typedef int __attribute__ ((__vector_size__ (8))) V;
+int b, c, e;
+V d;
+
+V
+foo (void)
+{
+ return (b || e) | c > d | ((b || e) | c > d);
+}
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 5f978ac78..62e7c8dca 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3853,7 +3853,7 @@ ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type,
return ERROR_MARK;
gassign *assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (cond));
- if (stmt == NULL
+ if (assign == NULL
|| TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) != tcc_comparison)
return ERROR_MARK;
--
2.27.0.windows.1

View File

@ -61,7 +61,7 @@
Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc
Version: %{gcc_version}
Release: 19
Release: 20
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
URL: https://gcc.gnu.org
@ -198,6 +198,9 @@ Patch81: 0081-Loop-distribution-Insert-temp-arrays-built-from-isom.patch
Patch82: 0082-Revert-Backport-tree-optimization-102880-make-PHI-OP.patch
Patch83: 0083-Struct-reorg-Add-struct-semi-relayout-optimize.patch
Patch84: 0084-MULL64-Disable-mull64-transformation-by-default.patch
Patch85: 0085-loop-distribution-Bugfix-for-loop-distribution.patch
Patch86: 0086-semi-relayout-Bugfix-for-struct-semi-relayout.patch
Patch87: 0087-Backport-tree-optimization-97238-fix-typo-causing-IC.patch
%global gcc_target_platform %{_arch}-linux-gnu
@ -736,6 +739,9 @@ not stable, so plugins must be rebuilt any time GCC is updated.
%patch82 -p1
%patch83 -p1
%patch84 -p1
%patch85 -p1
%patch86 -p1
%patch87 -p1
%build
@ -2759,6 +2765,13 @@ end
%doc rpm.doc/changelogs/libcc1/ChangeLog*
%changelog
* Fri Dec 23 2022 benniaobufeijiushiji <linda7@huawei.com> - 10.3.1-20
- Type:Sync
- ID:NA
- SUG:NA
- DESC:Sync patch from openeuler/gcc
Bugfix for loop-distribution, semi-relayout and mull64.
* Mon Dec 19 2022 liyancheng <412998149@qq.com> - 10.3.1-19
- Type:Fix
- ID:NA