re PR tree-optimization/91063 (ICE in set_vinfo_for_stmt, at tree-vectorizer.c:676)
authorJakub Jelinek <jakub@redhat.com>
Thu, 4 Jul 2019 07:25:28 +0000 (09:25 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 4 Jul 2019 07:25:28 +0000 (09:25 +0200)
PR tree-optimization/91063
* tree-vect-stmts.c (vect_init_vector): Call gsi_remove to remove
stmt from stmts sequence before calling vect_init_vector_1.
Formatting fix.

* gcc.dg/gomp/pr91063.c: New test.

From-SVN: r273041

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr91063.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 624cf765e37c2d3a48370f0ee01e8b60bdda72ce..99a653cb1620d6d1b97fef6012bb07e3796e0d38 100644 (file)
@@ -1,3 +1,10 @@
+2019-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91063
+       * tree-vect-stmts.c (vect_init_vector): Call gsi_remove to remove
+       stmt from stmts sequence before calling vect_init_vector_1.
+       Formatting fix.
+
 2019-07-04  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR target/88833
index 5bcd7fbe6bcd4c80752cf8886f4fd6c62d8af50a..9021bd781202cdde76e4c3630eafca10c24e6cf4 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91063
+       * gcc.dg/gomp/pr91063.c: New test.
+
 2019-07-04  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR target/88833
diff --git a/gcc/testsuite/gcc.dg/gomp/pr91063.c b/gcc/testsuite/gcc.dg/gomp/pr91063.c
new file mode 100644 (file)
index 0000000..32938f3
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR tree-optimization/91063 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp-simd" } */
+/* { dg-additional-options "-mavx512f" { target { i?86-*-* x86_64-*-* } } } */
+
+struct S { void *s; };
+
+int
+foo (struct S *x)
+{
+  int r = 0;
+  int i;
+#pragma omp simd reduction (+ : r)
+  for (i = 0; i < 64; ++i)
+    r += (int) (x->s != 0);
+  return r;
+}
index 313b1b91a6d4df77be7c405e5510092983684aa3..ead079dac45857d10ddfd130d376f264f64b3d2d 100644 (file)
@@ -1496,15 +1496,19 @@ vect_init_vector (stmt_vec_info stmt_info, tree val, tree type,
                   promotion of invariant/external defs.  */
                val = gimple_convert (&stmts, TREE_TYPE (type), val);
              for (gimple_stmt_iterator gsi2 = gsi_start (stmts);
-                  !gsi_end_p (gsi2); gsi_next (&gsi2))
-               vect_init_vector_1 (stmt_info, gsi_stmt (gsi2), gsi);
+                  !gsi_end_p (gsi2); )
+               {
+                 init_stmt = gsi_stmt (gsi2);
+                 gsi_remove (&gsi2, false);
+                 vect_init_vector_1 (stmt_info, init_stmt, gsi);
+               }
            }
        }
       val = build_vector_from_val (type, val);
     }
 
   new_temp = vect_get_new_ssa_name (type, vect_simple_var, "cst_");
-  init_stmt = gimple_build_assign  (new_temp, val);
+  init_stmt = gimple_build_assign (new_temp, val);
   vect_init_vector_1 (stmt_info, init_stmt, gsi);
   return new_temp;
 }