Computing the iteration space of nested loops

Hi All,

I am trying to experiment with SCEV.

For the below test, I want to know how I can get the max address accessed for array c.
Max address accessed would be

  1. When i loop is at its last iteration (n-1)
  2. When k loop is at its last iteration (n-1)

How to get this in terms of SCEV.

TEST:
int i,j,k,sum ;

int fn(int *a, int *b, int *c, int n)
{
int i,j,k,sum ;
for (k = 0 ;k <n; ++k) {
for (j = 0 ;j <n; ++j) {
for (i = 0 ;i <n; ++i) {
a[i] = b[i] + c[i + k] ;
}}}
return sum;
}

-Ganesh