This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa]: GIMPLE lowering array references too early?
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: gcc at gcc dot gnu dot org
- Cc: jason at redhat dot com, dnovillo at redhat dot com
- Date: Tue, 29 Jul 2003 12:46:23 -0400 (EDT)
- Subject: Re: [tree-ssa]: GIMPLE lowering array references too early?
- References: <Pine.LNX.4.56.0307291223390.15627@dberlin.org>
On Tue, 29 Jul 2003, Daniel Berlin wrote:
> 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.
Sigh.
This seems to be the fault of the c front end, not the gimplifier.
It only builds array_refs in certain cases.