Hi!

In these cases the stmts vectorize_fold_left_reduction is removing may have
EH region of -2 attached to them, but because they are removed with false
as remove_permanently or update_eh_info, the old stmts are kept in the EH
tables and cause checking ICE.

>From what I understand, the stmts are really removed permanently, so fixed
thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2018-11-19  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/88071
        * tree-vect-loop.c (vectorize_fold_left_reduction): Pass true instead
        of false as last argument to gsi_remove.
        * tree-vect-stmts.c (vect_finish_replace_stmt): Pass true instead of
        false as last argument to gsi_replace.

        * gcc.dg/pr88071.c: New test.

--- gcc/tree-vect-loop.c.jj     2018-11-16 10:22:20.037235568 +0100
+++ gcc/tree-vect-loop.c        2018-11-19 11:12:48.463267700 +0100
@@ -5861,7 +5861,7 @@ vectorize_fold_left_reduction (stmt_vec_
          /* Remove the statement, so that we can use the same code paths
             as for statements that we've just created.  */
          gimple_stmt_iterator tmp_gsi = gsi_for_stmt (new_stmt);
-         gsi_remove (&tmp_gsi, false);
+         gsi_remove (&tmp_gsi, true);
        }
 
       if (i == vec_num - 1)
--- gcc/tree-vect-stmts.c.jj    2018-11-16 10:22:20.061235172 +0100
+++ gcc/tree-vect-stmts.c       2018-11-19 11:47:41.480260582 +0100
@@ -1720,7 +1720,7 @@ vect_finish_replace_stmt (stmt_vec_info
   gcc_assert (gimple_get_lhs (stmt_info->stmt) == gimple_get_lhs (vec_stmt));
 
   gimple_stmt_iterator gsi = gsi_for_stmt (stmt_info->stmt);
-  gsi_replace (&gsi, vec_stmt, false);
+  gsi_replace (&gsi, vec_stmt, true);
 
   return vect_finish_stmt_generation_1 (stmt_info, vec_stmt);
 }
--- gcc/testsuite/gcc.dg/pr88071.c.jj   2018-11-19 11:55:11.364945562 +0100
+++ gcc/testsuite/gcc.dg/pr88071.c      2018-11-19 11:55:05.682037075 +0100
@@ -0,0 +1,5 @@
+/* PR tree-optimization/88071 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fexceptions -fnon-call-exceptions -fopenmp-simd -ftrapv 
-ftree-loop-vectorize" } */
+
+#include "gomp/openmp-simd-2.c"

        Jakub

Reply via email to