This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] for PR 18040
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Oct 2004 11:14:18 -0400
- Subject: Re: [patch] for PR 18040
- References: <10410181452.AA03986@vlsi1.ultra.nyu.edu>
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?
Yes.
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;
and
c = 10 + 20
return c;
or even about the difference between
return 10 + 20;
and
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.
--Dan