Hi,

On Thu, 5 Jul 2007, I wrote:

> Exactly and that's why I think this transformation is done far too early. 
> It doesn't make sense that these two examples produce different code:
> 
> int foo1(int x)
> {
>       return (x * 4) + 4;
> }
> int foo2(int x)
> {
>       int y = x * 4;
>       return y + 4;
> }

Another example:

int foo3(int x, int y)
{       
        return (x * y) + (y * 5);
}
int foo4(int x, int y)
{       
        x *= y;
        return x + (y * 5);
}

Here the generated code depends on how the constant multiply is expanded, 
so that combine can do the optimization.

bye, Roman

Reply via email to