re PR tree-optimization/91145 (ICE: in vect_build_slp_tree_2, at tree-vect-slp.c...
authorRichard Biener <rguenther@suse.de>
Fri, 12 Jul 2019 14:36:50 +0000 (14:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 12 Jul 2019 14:36:50 +0000 (14:36 +0000)
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.

From-SVN: r273445

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr91145.c [new file with mode: 0644]
gcc/tree-vect-slp.c

index 2d1d29f005c1f09fd544cc4e31b19620ba91ee4d..84fee9e0dd94fb24879618212a1134bef120f683 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2019-07-12  Alexandre Oliva <oliva@adacore.com>
 
        * tree-eh.c (honor_protect_cleanup_actions): Use outer_
index debec92a89fdc5a3a3fb1733e2624a7b1429f191..e948a715679676490c3481f97ca882967d8b0631 100644 (file)
@@ -1,7 +1,11 @@
+2019-07-12  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/91145
+       * gcc.dg/torture/pr91145.c: New testcase.
+
 2019-07-12  Alexandre Oliva <oliva@adacore.com>
 
        * gcc.dg/gimplefe-44.c: New.
-
        * gcc.dg/gimplefe-43.c: New.
 
 2019-07-12  Richard Biener  <rguenther@suse.de>
diff --git a/gcc/testsuite/gcc.dg/torture/pr91145.c b/gcc/testsuite/gcc.dg/torture/pr91145.c
new file mode 100644 (file)
index 0000000..7d62ad1
--- /dev/null
@@ -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 d172c3a75ae2f221166a74ec88d7360c01840c57..31f4519ff5ae989cbf108482af86a477f46e7c36 100644 (file)
@@ -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)