https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94443
--- Comment #7 from Kewen Lin <linkw at gcc dot gnu.org> --- Yes, thanks Richi! I had the same update locally but didn't update here. The latest whole patch is diff --git a/gcc/testsuite/gcc.dg/vect/pr94443.c b/gcc/testsuite/gcc.dg/vect/pr94443.c new file mode 100644 index 0000000..f8cbaf1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr94443.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=znver2" { target { x86_64-*-* i?86-*-* } } } */ + +/* Check it to be compiled successfully without any ICE. */ + +int a; +unsigned *b; + +void foo() +{ + for (unsigned i; i <= a; ++i, ++b) + ; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c9b6534..b621f89 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8050,7 +8050,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info, if (stmts) { gimple_stmt_iterator exit_gsi = gsi_after_labels (exit_bb); - gsi_insert_before (&exit_gsi, stmts, GSI_CONTINUE_LINKING); + gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT); /* Remove existing phi from lhs and create one copy from new_tree. */ tree lhs_phi = NULL_TREE; @@ -8060,10 +8060,10 @@ vectorizable_live_operation (stmt_vec_info stmt_info, gimple *phi = gsi_stmt (gsi); if ((gimple_phi_arg_def (phi, 0) == lhs)) { - remove_phi_node (&gsi, false); lhs_phi = gimple_phi_result (phi); gimple *copy = gimple_build_assign (lhs_phi, new_tree); - gsi_insert_after (&exit_gsi, copy, GSI_CONTINUE_LINKING); + gsi_insert_before (&exit_gsi, copy, GSI_SAME_STMT); + remove_phi_node (&gsi, false); break; } } Still waiting for regression testing result.