From: Jakub Jelinek Date: Thu, 4 Jul 2019 07:25:28 +0000 (+0200) Subject: re PR tree-optimization/91063 (ICE in set_vinfo_for_stmt, at tree-vectorizer.c:676) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f01ad76c11eacc9f32539f769e4cb3fd169466a;p=gcc.git re PR tree-optimization/91063 (ICE in set_vinfo_for_stmt, at tree-vectorizer.c:676) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 624cf765e37..99a653cb162 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-04 Jakub Jelinek + + 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 PR target/88833 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5bcd7fbe6bc..9021bd78120 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-07-04 Jakub Jelinek + + PR tree-optimization/91063 + * gcc.dg/gomp/pr91063.c: New test. + 2019-07-04 Prathamesh Kulkarni 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 index 00000000000..32938f301b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr91063.c @@ -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; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 313b1b91a6d..ead079dac45 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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; }