Simple loops not interchanged?

Andrew Pinski pinskia@physics.uc.edu
Fri Dec 10 16:21:00 GMT 2004


On Dec 10, 2004, at 10:36 AM, 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.
>
> What's going wrong here?

First file a bug.
Second the loop linearizer loves ARRAY_REF and not INDIRECT_REF
for 4.1, we should be able to get MEM_REF which is like ARRAY_REF
and the loop lineaerizer will just do its job.

I tested the theory by having a local array instead of passing
the pointer.

Thanks,
Andrew Pinski



More information about the Gcc mailing list