1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fdump-tree-lim2-details" } */
       3  
       4  volatile int flag, bar;
       5  double foo (double *valp)
       6  {
       7    double sum = 0;
       8    for (int i = 0; i < 256; ++i)
       9      {
      10        if (flag)
      11  	for (int j = 0; j < 256; ++j)
      12  	  bar = flag;
      13        if (flag)
      14          sum += 1.;
      15        sum += *valp; // we should move the load of *valp out of the loop
      16      }
      17    return sum;
      18  }
      19  
      20  /* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim2" } } */