(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
scev-8.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fdump-tree-ivopts-details" } */
       3  
       4  int *a;
       5  
       6  #if __SIZEOF_INT__ == __SIZEOF_SHORT__
       7  typedef char small_t;
       8  #else
       9  typedef short small_t;
      10  #endif
      11  
      12  int
      13  foo1 (long long s, long long l)
      14  {
      15    long long i;
      16  
      17    for (i = s; i < l; i++)
      18      {
      19        a[(small_t)i] = 0;
      20      }
      21    return 0;
      22  }
      23  
      24  int
      25  foo2 (unsigned char s, unsigned char l, unsigned char c)
      26  {
      27    unsigned char i, step = 1;
      28    int sum = 0;
      29  
      30    for (i = s; i < l; i++)
      31      {
      32        sum += a[c];
      33        c += step;
      34      }
      35  
      36    return sum;
      37  }
      38  
      39  int
      40  foo3 (unsigned char s, unsigned char l, unsigned char c)
      41  {
      42    unsigned char i;
      43    int sum = 0;
      44  
      45    for (i = s; i != l; i += c)
      46      {
      47        sum += a[i];
      48      }
      49  
      50    return sum;
      51  }
      52  
      53  int
      54  foo4 (unsigned char s, unsigned char l)
      55  {
      56    unsigned char i;
      57    int sum = 0;
      58  
      59    for (i = s; i != l; i++)
      60      {
      61        sum += a[i];
      62      }
      63  
      64    return sum;
      65  }
      66  
      67  /* Address of array references are not scevs.  */
      68  /* { dg-final { scan-tree-dump-not "  Type:\\tREFERENCE ADDRESS\n" "ivopts" } } */