(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
ldist-2.c
       1  /* { dg-do compile } */ 
       2  /* { dg-options "-O2 -ftree-loop-distribution -fdump-tree-ldist-all" } */
       3  
       4  void foo (int * __restrict__ a,
       5  	  int * __restrict__ b,
       6  	  int * __restrict__ c)
       7  {
       8    int i;
       9  
      10    for (i=1; i < 10; i++)
      11      {
      12        a[i] += c[i];
      13        b[i] = a[i - 1] + 1;
      14      }
      15  
      16    /* This loop is not distributed because the cost of spliting it:
      17  
      18       |  for (i=1; i < N; i++)
      19       |    a[i] += c[i];
      20       |
      21       |  for (i=1; i < N; i++)
      22       |    b[i] = a[i - 1] + 1;
      23  
      24       is higher due to data in array A that is written and then read in
      25       another task.  The cost model should forbid the transformation in
      26       this case.
      27    */
      28  }
      29  
      30  /* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" } } */