From: Richard Biener Date: Mon, 15 Jan 2024 09:03:59 +0000 (+0100) Subject: tree-optimization/113385 - wrong loop father with early exit vectorization X-Git-Tag: basepoints/gcc-15~2896 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afac1bd33657a5054f5e6ea6746c25bbb70b82f2;p=thirdparty%2Fgcc.git tree-optimization/113385 - wrong loop father with early exit vectorization The following avoids splitting an edge before redirecting it. This allows the loop father of the new block to be correct in the first place. PR tree-optimization/113385 * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg): First redirect, then split the exit edge. --- diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 1d6e5e045c38..c7e73f651559 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1613,11 +1613,11 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, { if (!alt_loop_exit_block) { - alt_loop_exit_block = split_edge (exit); edge res = redirect_edge_and_branch ( - single_succ_edge (alt_loop_exit_block), + exit, new_preheader); flush_pending_stmts (res); + alt_loop_exit_block = split_edge (res); continue; } dest = alt_loop_exit_block;