https://gcc.gnu.org/g:50d0fda4905b01bce87a6a733fe23c70cee3860a
commit r14-10777-g50d0fda4905b01bce87a6a733fe23c70cee3860a Author: Richard Biener <rguent...@suse.de> Date: Mon Oct 7 11:24:12 2024 +0200 tree-optimization/116990 - missed control flow check in vect_analyze_loop_form The following fixes checking for unsupported control flow in vectorization to also cover the outer loop body. PR tree-optimization/116990 * tree-vect-loop.cc (vect_analyze_loop_form): Check the current loop body for control flow. (cherry picked from commit b0b71618157ddac52266909978f331406f98f3a2) Diff: --- gcc/tree-vect-loop.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index d5504930a99d..744044735d39 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -1751,9 +1751,8 @@ vect_analyze_loop_form (class loop *loop, vect_loop_form_info *info) exit_e->src->index, exit_e->dest->index, exit_e->aux); /* Check if we have any control flow that doesn't leave the loop. */ - class loop *v_loop = loop->inner ? loop->inner : loop; - basic_block *bbs = get_loop_body (v_loop); - for (unsigned i = 0; i < v_loop->num_nodes; i++) + basic_block *bbs = get_loop_body (loop); + for (unsigned i = 0; i < loop->num_nodes; i++) if (EDGE_COUNT (bbs[i]->succs) != 1 && (EDGE_COUNT (bbs[i]->succs) != 2 || !loop_exits_from_bb_p (bbs[i]->loop_father, bbs[i])))