Vectorizing HIRLAM 2: One out of the "unhandled data-ref" garbage bin :-)

Andrew Pinski pinskia@physics.uc.edu
Fri Oct 21 13:34:00 GMT 2005


On Oct 21, 2005, at 9:19 AM, Toon Moene wrote:

> L.S.,
>
> This code:
>
>       SUBROUTINE S(A, B, N)
>       DIMENSION A(N), B(N)
>       READ*,Z,B
>       DO I = 1, N
>          A(I) = Z * B(I)
>       ENDDO
>       PRINT*,A
>       END
>
> when compiled thusly:

The problem here is not really related to the vectorizer but the
tree aliasing code.  The loop looks like this at -O2 in the tree dumps:
   # z_49 = PHI <z_86(1), z_124(3)>;
   # i_1 = PHI <1(1), i_48(3)>;
<L8>:;
   D.982_41 = i_1 + -1;
   #   VUSE <z_49>;
   D.983_43 = (*b_20)[D.982_41];
   #   VUSE <z_49>;
   z.4_45 = z;
   D.985_46 = D.983_43 * z.4_45;
   #   z_124 = V_MAY_DEF <z_49>;
   (*a_36)[D.982_41] = D.985_46;
   i_48 = i_1 + 1;
   if (i_1 == D.972_25) goto <L4>; else goto <L13>;

Notice how the statement which does "A(I) =" has a V_MAY_DEF of z.  If 
we
recorded it correctly,  A and B would aliasing nothing as they are 
arguments
passed in.

-- Pinski



More information about the Gcc mailing list