[PATCH] Fix canonicalization of addresses

Eric Botcazou ebotcazou@adacore.com
Tue Jan 6 14:43:00 GMT 2009


> In the above case transforming -A * -CST to A * CST (which would handle
> the (1 - ind) * -2 case also if witten that way by a user, not only if
> generated by fold_plusminus_mult).  Thus, it subsumes the plusminus_mult
> patch in favor of a IMHO better one.

I disagree.  The factorization by a negative power of 2 in plusminus_mult 
doesn't serve any useful purpose and can be harmful, as shown here; instead 
of relying on a later transformation to repair the damages, let's not create 
them in the first place, this will save both time and memory.

> I think a proper place to change canonicalization would be during
> induction variable optimization - why does that not happen?  It should
> at least in theory decompose the addresse to affine combinations and
> see this opportunity.

But the canonicalization issue is orthogonal to loops.  When you're expanding 
addresses, you can really help CSE if all the addresses follow the scheme 
base + index + displacement in this order.

> I was asking, with -O2 (where we do the same folds), what does "fix" it
> without your patch?  Thus, why is the regression only there for -Os?

Andrew, do you have the answer to this one?

-- 
Eric Botcazou



More information about the Gcc-patches mailing list