https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94443

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
This case has one conversion insn generated after bit_field_ref, the patch
introduces one stupid mistake to use gsi_insert_before instead of
gsi_insert_seq_before, it leads to miss the conversion insn.  The below patch
makes it work. It also polishes copy related code a bit although not really
necessary to make this case pass.

diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index c9b6534..4c2c9f7 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_after (&exit_gsi, copy, GSI_NEW_STMT);
+             remove_phi_node (&gsi, false);
              break;
            }
        }

Reply via email to