This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [lno] missing optimization
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: gcc at gnu dot org
- Date: Sun, 16 May 2004 21:24:59 +0200
- Subject: Re: [lno] missing optimization
- References: <324E2230-A75E-11D8-BEF4-000A95D7D16C@apple.com>
Hello,
> Currently the tree loop optimizer is overconservative about aliasing in
> invariant detection.
> For example:
>
> int x; int y;
> int foo() {
> int i;
> for ( i=0; i<10; i++)
> y += x*x;
> }
> struct { int x; int y; } global;
> int foo2() {
> int i;
> for ( i=0; i<10; i++)
> global.y += global.x*global.x;
> }
>
> The loop bodies of both functions ought to have the same code, and they
> do on mainline.
> lno doesn't figure out that global.x and global.y don't interfere. It
> looks at SSA_NAME_DEF_STMT,
yes, this is a known deficiency of tree-ssa aliasing (see PR 14784).
Zdenek
> but that refers to a PHI that applies to the entire struct. I see that
> breaking the struct into
> scalars at an earlier stage would fix this. Is there a better way?