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        for (int j = 0; j < 256; ++j)
      11          bar = flag;
      12        if (flag)
      13          sum += 1.;
      14        sum += *valp; // we should move the load of *valp out of the loop
      15      }
      16    return sum;
      17  }
      18  
      19  /* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim2" } } */