[tree-ssa] Out of SSA status and issues
Michael Matz
matz@suse.de
Tue May 13 13:40:00 GMT 2003
Hi,
On Tue, 13 May 2003, Richard Kenner wrote:
> I see nothing wrong in replacing 'i + 9' with '*p + 9'. It would
> probably not be efficient, but I can't see it being wrong.
>
> If an optimizer pessimizes the code, I'd consider that "wrong".
>
> This isn't a machine-dependent issue: with CPU speeds the way they are,
> a memory reference is *always* many times more expensive than an addition.
You apply a much too narrow view to optimization, or better to
transformation. For instance in this situation:
p1 = *p2;
... nothing changing *p2 or using p1...
p3 = p1 + 1;
Suppose there is register pressure and we are in the register allocator
and decide that p1 doesn't get a hardreg. If you now don't allow the use
of p1 to be replaced with *p2, you are forced to emit such code:
p1 = *p2;
stack[place] = p1;
... nothing changing *p2 or using p1...
p3 = stack[place] + 1;
whereas it would have been better to use *p2 directly:
(p1 = ... removed, because dead)
... nothing changing ....
p3 = *p2 + 1;
I.e. it depends on the context if you want to replace register references
with memory accesses or not. You can't just say it pessimizes code in all
cases.
Ciao,
Michael.
More information about the Gcc
mailing list