This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Re-run of loop pass
- To: law at cygnus dot com
- Subject: Re: Re-run of loop pass
- From: Michael Hayes <m dot hayes at elec dot canterbury dot ac dot nz>
- Date: Sun, 18 Oct 1998 22:13:45 +1300 (NZDT)
- Cc: Michael Hayes <m dot hayes at elec dot canterbury dot ac dot nz>, egcs at cygnus dot com
- References: <"13865.9178.455954.70561"@ongaonga.elec.canterbury.ac.nz><18798.908694891@hurl.cygnus.com>
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.