This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] for PR 18040

On Oct 18, 2004, at 10:52 AM, Richard Kenner wrote:

A quick check of a random function handling component_refs shows they
will also be missing optimizations

Let me be very clear here:

If the nops aren't needed, they won't be there. So the question isn't
if they are needed or not. Rather, it's whether the expression should be
split up among statements.

Are you really arguing that it's more likely to miss optimizations if they
are in *one* statement than if they are in multiple statements?


 If so,
can you explain?

It is much easier to optimize expressions that are simple, regardless of how they are split up, because it makes your optimizers simpler to write, and you are much less likely to miss corner cases, etc.

There is no magic problem with a statement being split up into multiple statements, because that's just not how algorithms to do optimization are written. From the POV, of say, CCP, it doesn't care about the difference between

a = 10
b = 20
c = a + b
return c;


c = 10 + 20
return c;

or even about the difference between

return 10 + 20;


a = 5
b = a + 2
c = b + 2
d = c + 1

e = 10
f = e + 5
g = f + 5

h = d + g

return h;

Both are just as easy to optimize.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]