]> git.ipfire.org Git - thirdparty/gcc.git/commit
Unloop loops that no longer loops in tree-ssa-loop-ch
authorJan Hubicka <jh@suse.cz>
Thu, 27 Apr 2023 13:49:37 +0000 (15:49 +0200)
committerJan Hubicka <jh@suse.cz>
Thu, 27 Apr 2023 13:49:37 +0000 (15:49 +0200)
commitf2d6beb7a4ddf18dd95fdcc336181a8702a9f55f
treebbc9f1449c74cdf0b8f661d8929105415ae9b42d
parent65369ab62cee68eb7f6ef65e3d12d1969a9e20ee
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
gcc/tree-ssa-loop-ch.cc
gcc/tree-ssa-loop-ivcanon.cc