Simple loops not interchanged?

Daniel Berlin dberlin@dberlin.org
Fri Dec 10 16:39:00 GMT 2004



On Fri, 10 Dec 2004, Andrew Pinski wrote:

>
> 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

First, i probably need to change the name, since some people think it 
linearizes loops, which it doesn't. It performs linear transforms :P.

Second, it doesn't care about array-ref or indirect-ref, actually.
It just uses what the data dependence info tells it.

The autovect branch has code to start to teach the data dependence 
analyzer about indirect_refs.

MEM_REFS in their current form look big, so i'm not sure they are an 
optimal solution (i'd rather see array_refs be changed to allow accesses 
to non-array_type things. After all, this is a fricking array he's 
accessing, so why isn't array_ref the right thing?)
--Dan



More information about the Gcc mailing list