This is the mail archive of the
`gcc-patches@gcc.gnu.org`
mailing list for the GCC project.

# Re: pretty-ipa merge 15: loop finiteness testing

*From*: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
*To*: Jan Hubicka <hubicka at ucw dot cz>
*Cc*: gcc-patches at gcc dot gnu dot org
*Date*: Sat, 25 Apr 2009 19:00:07 +0200
*Subject*: Re: pretty-ipa merge 15: loop finiteness testing
*References*: <20090425101811.GA23792@kam.mff.cuni.cz>

Hi,
> this patch adds finite_loop_p I would like to use in pure/const and cd-dce later.
> It is basically same logic as in niter, just bit relaxed in three ways:
>
> 1) It is not working hard enough to find minimal number of iterations
> 2) In pure/const functions it assumes that all loops must be finite.
> 3) It also assume for flag_unsafe_loop_optimizations.
>
> I would hope that later we will add more tricks.
>
> I also wonder why !just_once_each_iteration_p is needed here? It does
> not matter if the exit sits inside nested loop, right?
it's used there to test that the exit is executed at least once in each
iteration.
> + /* Return true if loop is known to be finite. */
> +
> + bool
> + finite_loop_p (struct loop *loop)
This comment is a bit missleading -- it is not entirely clear
what does it mean that the loop is finite. finite_loop_p can return true for
loops that never end (e.g. if the loop has an infinite subloop, or
calls a function containing such a loop).
Otherwise OK,
Zdenek