[PATCH] Fix canonicalization of addresses

Richard Guenther richard.guenther@gmail.com
Tue Jan 6 22:30:00 GMT 2009


On Tue, Jan 6, 2009 at 11:19 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> To repeat: it's a canonicalization.  And it helps for canonicalizing a
>> * (-2) - 8 to (a + 4)*(-2)
>> and allowing CSE with another a + 4.  I don't think that in this case
>> we want to have (-4 - a)*2.
>
> The - - should be canonicalized elsewhere.

How?  By extracting the common multiplication by -1? ...

> Changing the sign without further
> analysis is just plain wrong and appears to be an unexpected fallout of the
> change, according to the comment:
>
>  /* No identical multiplicands; see if we can find a common
>     power-of-two factor in non-power-of-two multiplies.  This
>     can help in multi-dimensional array access.  */

Well, the change was to merge different similar transformations if I remember
correctly.  Also the change just introduced a more complete canonicalization.
So the comment is out-of-date.

And yes, we miss a (1 - i) * -2 to (i - 1) * 2 canonicalization, but I
think I said that, no?
Why do you keep arguing?  (or rather, why do I?)

Richard.



More information about the Gcc-patches mailing list