new file mode 100644
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-add-options vect_early_break } */
+
+int g_66, g_80_2;
+void func_1func_41(int p_43)
+{
+lbl_1434:
+ g_80_2 = 0;
+ for (; g_80_2 <= 7; g_80_2 += 1) {
+ g_66 = 0;
+ for (; g_66 <= 7; g_66 += 1)
+ if (p_43)
+ goto lbl_1434;
+ }
+}
@@ -11787,6 +11787,7 @@ move_early_exit_stmts (loop_vec_info loop_vinfo)
basic_block dest_bb = LOOP_VINFO_EARLY_BRK_DEST_BB (loop_vinfo);
gimple_stmt_iterator dest_gsi = gsi_after_labels (dest_bb);
+ tree last_seen_vuse = NULL_TREE;
for (gimple *stmt : LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo))
{
/* We have to update crossed degenerate virtual PHIs. Simply
@@ -11805,6 +11806,7 @@ move_early_exit_stmts (loop_vec_info loop_vinfo)
}
auto gsi = gsi_for_stmt (stmt);
remove_phi_node (&gsi, true);
+ last_seen_vuse = vuse;
continue;
}
@@ -11819,17 +11821,17 @@ move_early_exit_stmts (loop_vec_info loop_vinfo)
gimple_stmt_iterator stmt_gsi = gsi_for_stmt (stmt);
gsi_move_before (&stmt_gsi, &dest_gsi, GSI_NEW_STMT);
+ last_seen_vuse = gimple_vuse (stmt);
}
/* Update all the stmts with their new reaching VUSES. */
- tree vuse
- = gimple_vuse (LOOP_VINFO_EARLY_BRK_STORES (loop_vinfo).last ());
for (auto p : LOOP_VINFO_EARLY_BRK_VUSES (loop_vinfo))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "updating vuse to %T for load %G", vuse, p);
- gimple_set_vuse (p, vuse);
+ "updating vuse to %T for load %G",
+ last_seen_vuse, p);
+ gimple_set_vuse (p, last_seen_vuse);
update_stmt (p);
}
@@ -11837,7 +11839,7 @@ move_early_exit_stmts (loop_vec_info loop_vinfo)
for (edge e : get_loop_exit_edges (LOOP_VINFO_LOOP (loop_vinfo)))
if (!dominated_by_p (CDI_DOMINATORS, e->src, dest_bb))
if (gphi *phi = get_virtual_phi (e->dest))
- SET_PHI_ARG_DEF_ON_EDGE (phi, e, vuse);
+ SET_PHI_ARG_DEF_ON_EDGE (phi, e, last_seen_vuse);
}
/* Function vect_transform_loop.