[tree-ssa]: GIMPLE lowering array references too early?

Daniel Berlin dberlin@dberlin.org
Tue Jul 29 17:09:00 GMT 2003


We used to keep array references around (instead of transforming into
address arithmetic), the thinking being that loop opts want them.
Somehow, this isn't happening anymore, and i don't remember discussion of
changing it (which i, and others, would have opposed, since loop opts
do need them). I think you switched it to always lower at some point,
Jason.

Watch:

int foo (int *a, int *b)
{
	int i,c = 0;
	for (i = 0; i < N; i++) {
	  c += a[i] * b[i];
	}
}

becomes

       i.1 = (unsigned int)i;
       T.2 = i.1 * 4;
       T.3 = (int *)T.2;
       T.4 = a + T.3;
       T.5 = *T.4;
etc

rather than keeping the a[i] reference.

Jason, was this a deliberate decision on your part, or an accident.

It would really be nice to have the array references back.
--Dan



More information about the Gcc mailing list