aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-10.c
blob: 649dfb0b2d8a68b4c42d72c0751d21809ca5f882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* { dg-do compile } */ 
/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev -fall-data-deps -fdump-tree-ddall" } */

void bar (int);

int foo (void)
{
  int a;
  int x;
  int c[100][100];
  
  /* loop_1 runs 39 times.  */
  for (a = 11; a < 50; a++)
    {
      /* Array access functions have to be analyzed.  */
      x = a + 5;
      c[x][a+1] = c[x+2][a+3] + c[x-1][a+2];
    }
  bar (c[1][2]);
}

/* The analyzer has to detect the scalar functions:
   a   ->  {11, +, 1}_1
   x   ->  {16, +, 1}_1
   x+2 ->  {18, +, 1}_1
   x-1 ->  {15, +, 1}_1
*/

/* { dg-final { scan-tree-dump-times "nb_iterations 39" 1 "scev"} } */
/* { dg-final { diff-tree-dumps "ddall" } } */