This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR91145
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Jul 2019 14:40:19 +0200 (CEST)
- Subject: [PATCH] Fix PR91145
The following fixes the PR.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard.
2019-07-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/91145
* tree-vect-slp.c (vect_build_slp_tree_2): Fix reduction
chain check.
* gcc.dg/torture/pr91145.c: New testcase.
Index: gcc/testsuite/gcc.dg/torture/pr91145.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr91145.c (nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr91145.c (working copy)
@@ -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;
+ }
+}
Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c (revision 273433)
+++ gcc/tree-vect-slp.c (working copy)
@@ -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)