From f2d6beb7a4ddf18dd95fdcc336181a8702a9f55f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 27 Apr 2023 15:49:37 +0200 Subject: Unloop loops that no longer loops in tree-ssa-loop-ch I noticed this after adding sanity check that the upper bound on number of iterations never drop to -1. It seems to be relatively common case (happening few hundred times in testsuite and also during bootstrap) that loop-ch duplicates enough so the loop itself no longer loops. This is later detected in loop unrolling but since we test the number of iterations anyway it seems better to do that earlier. * cfgloopmanip.h (unloop_loops): Export. * tree-ssa-loop-ch.cc (ch_base::copy_headers): Unloop loops that no longer loop. * tree-ssa-loop-ivcanon.cc (unloop_loops): Export; do not free vectors of loops to unloop. (canonicalize_induction_variables): Free vectors here. (tree_unroll_loops_completely): Free vectors here. --- gcc/cfgloopmanip.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/cfgloopmanip.h') diff --git a/gcc/cfgloopmanip.h b/gcc/cfgloopmanip.h index c40cfea..75b2a5e 100644 --- a/gcc/cfgloopmanip.h +++ b/gcc/cfgloopmanip.h @@ -43,6 +43,10 @@ extern edge create_empty_if_region_on_edge (edge, tree); extern class loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree, tree *, tree *, class loop *); extern void unloop (class loop *, bool *, bitmap); +extern void unloop_loops (vec &loops_to_unloop, + vec &loops_to_unloop_nunroll, + bitmap loop_closed_ssa_invalidated, + bool *irred_invalidated); extern void copy_loop_info (class loop *loop, class loop *target); extern class loop * duplicate_loop (class loop *, class loop *, class loop * = NULL); -- cgit v1.1