ivopts improvement
Zdenek Dvorak
rakdver@kam.mff.cuni.cz
Mon Mar 14 12:55:00 GMT 2011
Hi,
> >> it is trying to allow for
> >>
> >> do
> >> {
> >> *p = '\0';
> >> i++; /* use_uses_inced_iv == true */
> >> p++; /* use_after_cand_inc == true */
> >> if (!(i < n))
> >> break;
> >> }
> >> while (1);
> >>
> >> and for
> >>
> >> do
> >> {
> >> *p = '\0';
> >> if (!(i < n))
> >> break;
> >> i++; /* use_uses_inced_iv == false */
> >> p++; /* use_after_cand_inc == false */
> >> }
> >> while (1);
> >>
> >> but not for
> >>
> >> do
> >> {
> >> *p = '\0';
> >> i++; /* use_uses_inced_iv == true */
> >> if (!(i < n))
> >> break;
> >> p++; /* use_after_cand_inc == false */
> >> }
> >> while (1);
> >>
> >> and not for
> >>
> >> do
> >> {
> >> *p = '\0';
> >> p++; /* use_after_cand_inc == true */
> >> if (!(i < n))
> >> break;
> >> i++; /* use_uses_inced_iv == false */
> >> }
> >> while (1);
> >>
> >> In the latter 2 cases, I cannot simply replace i < n with p < base + n.
> >
> > Why not (other than that the value to compare with varies in these cases, but
> > it always is "the value of p in the last iteration of the loop")?
>
> In the 2 latter cases, the value to compare with will be either base + n
> + 1 or base + n - 1. The code does not handle these cases yet.
well, if not, then it certainly handles one of the first two cases incorrectly
(since the use_uses_inced_iv test is meaningless).
> > One more thing: what is fold_walk_def_plus for?
>
> It tries to fold a plus, and if not successful, finds ssa vars in
> operands of the plus, substitutes the defining statements of ssa vars
> for those ssa vars and retries folding.
Sorry for not being more clear; I meant, why is it used?
Zdenek
More information about the Gcc-patches
mailing list