(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-live-2.c
       1  /* Disabling epilogues until we find a better way to deal with scans.  */
       2  /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
       3  /* { dg-require-effective-target vect_long } */
       4  /* { dg-require-effective-target vect_shift } */
       5  /* { dg-additional-options "-fno-tree-scev-cprop" } */
       6  
       7  #include "tree-vect.h"
       8  
       9  /* Statement used outside the loop.
      10     NOTE: SCEV disabled to ensure the live operation is not removed before
      11     vectorization.  */
      12  __attribute__ ((noinline)) int
      13  liveloop (int start, int n, int *x, int *y)
      14  {
      15    int i = start;
      16    int j;
      17    int ret;
      18  
      19    for (j = 0; j < n; ++j)
      20      {
      21        i += 1;
      22        x[j] = i;
      23        ret = y[j];
      24      }
      25    return ret;
      26  }
      27  
      28  #define MAX 97
      29  #define START 13
      30  
      31  int
      32  main (void)
      33  {
      34    int a[MAX];
      35    int b[MAX];
      36    int i;
      37  
      38    check_vect ();
      39  
      40    for (i=0; i<MAX; i++)
      41      {
      42        __asm__ volatile ("");
      43        b[i] = i;
      44      }
      45  
      46    int ret = liveloop (START, MAX, a, b);
      47  
      48    if (ret != MAX - 1)
      49      abort ();
      50  
      51    for (i=0; i<MAX; i++)
      52      {
      53        __asm__ volatile ("");
      54        if (a[i] != i+START+1)
      55  	abort ();
      56      }
      57  }
      58  
      59  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
      60  /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 1 "vect" } } */