diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb1a9be39eb..4a059c97108 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-02-20 Dorit Naishlos + + PR tree-optimization/19951 + * tree-vect-analyze.c (vect_analyze_loop_form): Check if loop exit edge + is abnormal. + 2005-02-19 Steven Bosscher PR middle-end/19698 diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index 7071199bfa0..fd26c90687e 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -2312,17 +2312,32 @@ vect_analyze_loop_form (struct loop *loop) } /* Make sure we have a preheader basic block. */ - if (!loop->pre_header) + if (!loop->pre_header || EDGE_COUNT (loop->pre_header->succs) != 1) { + edge e = loop_preheader_edge (loop); + loop_split_edge_with (e, NULL); + if (vect_print_dump_info (REPORT_DETAILS, loop_loc)) + fprintf (vect_dump, "split preheader edge."); rescan = true; - loop_split_edge_with (loop_preheader_edge (loop), NULL); } /* Make sure there exists a single-predecessor exit bb: */ - if (EDGE_COUNT (loop->exit_edges[0]->dest->preds) != 1) + if (EDGE_COUNT (loop->single_exit->dest->preds) != 1) { - rescan = true; - loop_split_edge_with (loop->exit_edges[0], NULL); + edge e = loop->single_exit; + if (!(e->flags & EDGE_ABNORMAL)) + { + loop_split_edge_with (e, NULL); + if (vect_print_dump_info (REPORT_DETAILS, loop_loc)) + fprintf (vect_dump, "split exit edge."); + rescan = true; + } + else + { + if (vect_print_dump_info (REPORT_BAD_FORM_LOOPS, loop_loc)) + fprintf (vect_dump, "not vectorized: abnormal loop exit edge."); + return NULL; + } } if (rescan)