This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Re-run of loop pass


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]