This is the mail archive of the gcc@gcc.gnu.org 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: [lno] missing optimization


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?



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