From cf91b5997dec281e4b784c163d76d5be3e8569f6 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 12 Jul 2019 14:36:50 +0000 Subject: [PATCH] re PR tree-optimization/91145 (ICE: in vect_build_slp_tree_2, at tree-vect-slp.c:1143 with -march=skylake-avx512 -O3) 2019-07-12 Richard Biener PR tree-optimization/91145 * tree-vect-slp.c (vect_build_slp_tree_2): Fix reduction chain check. * gcc.dg/torture/pr91145.c: New testcase. From-SVN: r273445 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 6 +++++- gcc/testsuite/gcc.dg/torture/pr91145.c | 16 ++++++++++++++++ gcc/tree-vect-slp.c | 3 ++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr91145.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d1d29f005c..84fee9e0dd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-12 Richard Biener + + PR tree-optimization/91145 + * tree-vect-slp.c (vect_build_slp_tree_2): Fix reduction + chain check. + 2019-07-12 Alexandre Oliva * tree-eh.c (honor_protect_cleanup_actions): Use outer_ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index debec92a89f..e948a715679 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,11 @@ +2019-07-12 Richard Biener + + PR tree-optimization/91145 + * gcc.dg/torture/pr91145.c: New testcase. + 2019-07-12 Alexandre Oliva * gcc.dg/gimplefe-44.c: New. - * gcc.dg/gimplefe-43.c: New. 2019-07-12 Richard Biener diff --git a/gcc/testsuite/gcc.dg/torture/pr91145.c b/gcc/testsuite/gcc.dg/torture/pr91145.c new file mode 100644 index 00000000000..7d62ad11faf --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr91145.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=skylake-avx512" { target x86_64-*-* i?86-*-* } } */ + +int a, c; +unsigned b, e; +extern unsigned d[100]; + +void f() +{ + for (int g = 0; g < 70; g++) + { + + b += d[g] - c; + e -= g ^ a; + } +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index d172c3a75ae..31f4519ff5a 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1140,7 +1140,8 @@ vect_build_slp_tree_2 (vec_info *vinfo, FOR_EACH_VEC_ELT (stmts, i, other_info) { /* But for reduction chains only check on the first stmt. */ - if (REDUC_GROUP_FIRST_ELEMENT (other_info) + if (!STMT_VINFO_DATA_REF (other_info) + && REDUC_GROUP_FIRST_ELEMENT (other_info) && REDUC_GROUP_FIRST_ELEMENT (other_info) != stmt_info) continue; if (STMT_VINFO_DEF_TYPE (other_info) != def_type) -- 2.30.2