aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-10.c
blob: bc149265dd7844125efbadc7d69fe8e30070fae4 (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
31
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-lim1-details" } */

int *l, *r;
int test_func(void)
{
  int i;
  int direction;
  static int pos;

  pos = 0;
  direction = 1;

  for ( i = 0; i <= 400; i++ )
    {
      if ( direction == 0 )
	pos = l[pos];
      else
	pos = r[pos];

      if ( pos == -1 )
	{
	  pos = 0;
	  direction = !direction;
	}
    }
  return i;
}

/* { dg-final { scan-tree-dump "Executing store motion of pos" "lim1" } } */
/* { dg-final { cleanup-tree-dump "lim1" } } */