This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Simple loops not interchanged?
On Fri, 10 Dec 2004, Richard Guenther wrote:
Hi!
I expected -ftree-loop-linear to exchange loops in
double foo(double *a)
{
int i,j;
double r = 0.0;
for (i=0; i<8; ++i)
for (j=0; j<8; ++j)
r += a[j*8+i];
return r;
}
but it tells me (regardless of loop order) that
"Won't transform loop. Optimal transform is the identity transform"
which I cannot believe, obviously.
Unfortunately, there is no array_ref in these :(
What's going wrong here?
The data dependence analyzer doesn't understand pointer-refs.
I started to make it nuderstand them on the autovect branch, but i'm not
sure it's good enough yet to disambiguate your case (as easy as it may
seem).
In fact, it doesn't, though it does see the data reference.
Data ref b:
(Data Ref:
stmt: D.1134_18 = *D.1133_17;
ref: *D.1133_17;
base_name: a_16
Access function 0: {{a_16, +, 8B}_1, +, 64B}_2
)
affine dependence test not usable: access function not affine or constant.
(dependence classified: scev_not_known)
)
When we don't know the data dependences of the loop, we can't touch them
(the message it prints should probably be changed in that case :P)
--Dan