[CFG] More aggresive constant_iterations
Jan Hubicka
jh@suse.cz
Wed May 29 04:16:00 GMT 2002
> Hello.
>
> > > Changelog:
> > > * loop.h (struct loop_desc): Field init replaced by var_alts,
> > > new field lim_alts.
> > > * unroll-new.c (variable_initial_values): New static function.
> > > (count_loop_iterations): Add arguments for explicit values of
> > > initial and final value.
> > > (simple_condition_p): Use variable_initial_values.
> > > (constant_iterations): More aggressive now.
> > > (simple_loop_exit_p): Use variable_initial_values, dump lim_alts and
> > > var_alts.
> > > (test_for_iteration, unroll_loop_runtime_iterations): Modified.
> >
> > OK,
> > Looks correct to me, so I will install it. In what testcases this
> > helps?
>
> The only one I'm able to think out is
>
> for (i=a;i<a+100;i++)
> {
> ...
> }
>
> Where we had problems because we were often not able to determine that
> it iterates 100 times (because value of a was copied and a+100 was
> calculated from the first place, for example); probably it is not very
> important, but this fix is more consistent than the previous one I made
> for this case.
I see, then I guess it is good idea to support the trick, since such
loops are definity not just artificial testcases.
>
> > Is the gain considerable? Can't we run into very expensive loops (where
> > we get a lot of alternatives)
>
> The alternatives are created only when registers are copied from one to
> other several times; I'm not sure how long and often such chains are. If
> the possibly quadratic behavior turned out to be a problem, it could be
> reworked so that it would be linear (it does not make much sense to
> compare every with every, when all members of the lists except the last
> one are just registers); I haven't done it because it is more general
> this way (although I don't have an idea whether/how it could help us in
> the future).
I guess CSE will break the copy chain to have maximal depth of one.
>
> Zdenek
More information about the Gcc-patches
mailing list