On Wed, 31 Oct 2012, Jan Hubicka wrote:

> > > -  FOR_EACH_VEC_ELT (edge, exits, i, ex)
> > > +  if (loop->any_upper_bound)
> > >      {
> > > -      if (!just_once_each_iteration_p (loop, ex->src))
> > > - continue;
> > > +      if (dump_file && (dump_flags & TDF_DETAILS))
> > > + fprintf (dump_file, "Found loop %i to be finite: upper bound is 
> > > recorded.\n",
> > > +          loop->num);
> > > +      return true;
> > > +    }
> > 
> > This looks redundant with ...
> > 
> > > -      if (number_of_iterations_exit (loop, ex, &desc, false))
> > > -        {
> > > -   if (dump_file && (dump_flags & TDF_DETAILS))
> > > -     {
> > > -       fprintf (dump_file, "Found loop %i to be finite: iterating ", 
> > > loop->num);
> > > -       print_generic_expr (dump_file, desc.niter, TDF_SLIM);
> > > -       fprintf (dump_file, " times\n");
> > > -     }
> > > -   finite = true;
> > > -   break;
> > > - }
> > > +  if (max_loop_iterations (loop, &nit))
> > > +    {
> > 
> > ... this.  If you want to short-circuit max_loop_iterations ()
> > then why not
> > 
> >    if (loop->any_upper_bound
> >        || max_loop_iterations (loop, &nit))
> >      {
> >        ...
> > 
> > ?  The different dumping seems not a good reason to obfuscate it.
> > 
> 
> Sounds good to me.  I only wanted to avoid max_loop_iterations re-trying to
> derrive the bound when it is already known to be finite.  I think I will
> eventually make max_loop_iterations and friends to do the hard work only once
> per loop optimizer queue or when asked to collect the current bounds (since
> the pointers to statements are hard to maintain).
> 
> OK with that change?

Ok.

Thanks,
Richard.

Reply via email to