!27 Fix dse ICE

From: @eastb233
Reviewed-by: @jdkboy
Signed-off-by: @jdkboy
This commit is contained in:
openeuler-ci-bot 2020-09-11 11:14:58 +08:00 committed by Gitee
commit cfde719c6f
3 changed files with 42 additions and 21 deletions

View File

@ -1,17 +0,0 @@
diff -Nurp a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
--- a/gcc/tree-ssa-dse.c 2020-09-09 15:47:21 084000000 +800
+++ b/gcc/tree-ssa-dse.c 2020-09-09 15:47:34 740000000 +800
@@ -119,10 +119,11 @@ initialize_ao_ref_for_dse (gimple *stmt,
{
tree nelem = gimple_call_arg (stmt, 0);
tree selem = gimple_call_arg (stmt, 1);
+ tree lhs;
if (TREE_CODE (nelem) == INTEGER_CST
- && TREE_CODE (selem) == INTEGER_CST)
+ && TREE_CODE (selem) == INTEGER_CST
+ && (lhs = gimple_call_lhs (stmt)) != NULL_TREE)
{
- tree lhs = gimple_call_lhs (stmt);
tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem),
nelem, selem);
ao_ref_init_from_ptr_and_size (write, lhs, size);

View File

@ -0,0 +1,35 @@
This backport contains 1 patch from gcc main stream tree.
The commit id of these patchs list as following in the order of time.
0001-Fix-ICE-when-__builtin_calloc-has-no-LHS-PR-tree-opt.patch
4c4be718fb65f9b8dd06d83c6fa3f697a5369d52
diff -Nurp a/gcc/testsuite/gcc.target/s390/pr91014.c b/gcc/testsuite/gcc.target/s390/pr91014.c
--- a/gcc/testsuite/gcc.target/s390/pr91014.c 1970-01-01 08:00:00.000000000 +0800
+++ b/gcc/testsuite/gcc.target/s390/pr91014.c 2020-09-09 15:47:34.740000000 +0800
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+/* { dg-require-effective-target alloca } */
+
+void foo(void)
+{
+ __builtin_calloc (1, 1); /* { dg-warning "ignoring return value of '__builtin_calloc' declared with attribute 'warn_unused_result'" } */
+}
diff -Nurp a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
--- a/gcc/tree-ssa-dse.c 2020-09-09 15:47:21.084000000 +0800
+++ b/gcc/tree-ssa-dse.c 2020-09-09 15:47:34.740000000 +0800
@@ -119,10 +119,11 @@ initialize_ao_ref_for_dse (gimple *stmt,
{
tree nelem = gimple_call_arg (stmt, 0);
tree selem = gimple_call_arg (stmt, 1);
+ tree lhs;
if (TREE_CODE (nelem) == INTEGER_CST
- && TREE_CODE (selem) == INTEGER_CST)
+ && TREE_CODE (selem) == INTEGER_CST
+ && (lhs = gimple_call_lhs (stmt)) != NULL_TREE)
{
- tree lhs = gimple_call_lhs (stmt);
tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem),
nelem, selem);
ao_ref_init_from_ptr_and_size (write, lhs, size);

View File

@ -1,4 +1,4 @@
%global DATE 20200909 %global DATE 20200911
%global gcc_version 9.3.1 %global gcc_version 9.3.1
%global gcc_major 9.3.1 %global gcc_major 9.3.1
@ -59,7 +59,7 @@
Summary: Various compilers (C, C++, Objective-C, ...) Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc Name: gcc
Version: %{gcc_version} Version: %{gcc_version}
Release: %{DATE}.4 Release: %{DATE}.6
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Source0: gcc-9.3.0.tar.xz Source0: gcc-9.3.0.tar.xz
%global isl_version 0.16.1 %global isl_version 0.16.1
@ -175,7 +175,7 @@ Patch60: fix-load-eliding-in-SM.patch
Patch61: fix-SSA-update-for-vectorizer-epilogue.patch Patch61: fix-SSA-update-for-vectorizer-epilogue.patch
Patch62: fix-ICE-when-vectorizing-nested-cycles.patch Patch62: fix-ICE-when-vectorizing-nested-cycles.patch
Patch63: fix-avoid-bogus-uninit-warning-with-store-motion.patch Patch63: fix-avoid-bogus-uninit-warning-with-store-motion.patch
Patch64: backport-fix-ICE-during-GIMPLE-pass-dse.patch Patch64: fix-ICE-during-GIMPLE-pass-dse.patch
%global gcc_target_platform %{_arch}-linux-gnu %global gcc_target_platform %{_arch}-linux-gnu
@ -2611,7 +2611,10 @@ end
%doc rpm.doc/changelogs/libcc1/ChangeLog* %doc rpm.doc/changelogs/libcc1/ChangeLog*
%changelog %changelog
* Wed Spe 09 2020 jdkboy <guoge1@huawei.com> - 9.3.1-20200909.5 * Fri Sep 11 2020 eastb233 <xiezhiheng@huawei.com> - 9.3.1-20200911.6
- fix-ICE-during-GIMPLE-pass-dse.patch: Add test case
* Wed Sep 09 2020 jdkboy <guoge1@huawei.com> - 9.3.1-20200909.5
- add backport-fix-ICE-during-GIMPLE-pass-dse.patch - add backport-fix-ICE-during-GIMPLE-pass-dse.patch
* Sat Sep 05 2020 eastb233 <xiezhiheng@huawei.com> - 9.3.1-20200905.4 * Sat Sep 05 2020 eastb233 <xiezhiheng@huawei.com> - 9.3.1-20200905.4