Re-run of loop pass
Michael Hayes
m.hayes@elec.canterbury.ac.nz
Sun Oct 18 03:11:00 GMT 1998
Jeffrey A Law writes:
> You should investigate why the second loop pass is unable to determine
> loop iteration counts.
Consider a simple dot product function like the following:
float foo(float *a, float *b)
{
int i;
float result = 0.0;
for (i = 0; i < 4; i++)
result += a[i] * b[i];
return result;
}
The first pass often eliminates the BIV associated with i and replaces
the end of loop test i < 4 with a comparison of the incremented
pointer associated with a + i with a + 4 (I think the elimination is
only performed for targets with autoincrement addressing modes). The
second pass then finds that the initial value of BIV associated with a
is not a constant and thus cannot determine the iteration count.
I imagine that the information regarding iteration counts should be
gathered on the first pass and then used on the second pass if needed.
Michael.
More information about the Gcc
mailing list