This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix canonicalization of addresses
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: "Richard Guenther" <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Andrew Haley <aph at redhat dot com>
- Date: Tue, 6 Jan 2009 15:17:32 +0100
- Subject: Re: [PATCH] Fix canonicalization of addresses
- References: <200812231211.50787.ebotcazou@adacore.com> <200812292202.57337.ebotcazou@adacore.com> <84fc9c000812291351w53a489bah875c219f1486f74e@mail.gmail.com>
> 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