aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-17.c
blob: 1c840e554b7ea8ea98bc30ae5bf6715e437da34a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-lim2-details" } */

volatile int flag, bar;
double foo (double *valp)
{
  double sum = 0;
  for (int i = 0; i < 256; ++i)
    {
      if (flag)
	for (int j = 0; j < 256; ++j)
	  bar = flag;
      if (flag)
        sum += 1.;
      sum += *valp; // we should move the load of *valp out of the loop
    }
  return sum;
}

/* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim2" } } */