(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-live-4.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_int } */
       4  
       5  #include "tree-vect.h"
       6  
       7  /* Statement used outside the loop, not used inside the loop.  SCEV cannot
       8    hoist the stmt.  */
       9  __attribute__ ((noinline)) int
      10  liveloop (int n, int *x, int *y)
      11  {
      12    int i;
      13    int ret;
      14  
      15    for (i = 0; i < n; ++i)
      16      {
      17        ret = x[i] + 5;
      18        y[i] = ret;
      19      }
      20    return ret;
      21  }
      22  
      23  #define MAX 273
      24  
      25  int
      26  main (void)
      27  {
      28    int a[MAX];
      29    int b[MAX];
      30    int i;
      31  
      32    check_vect ();
      33  
      34    for (i=0; i<MAX; i++)
      35      {
      36        __asm__ volatile ("");
      37        a[i] = i;
      38      }
      39  
      40    int ret = liveloop (MAX, a, b);
      41  
      42    if (ret != MAX + 4)
      43      abort ();
      44  
      45    for (i=0; i<MAX; i++)
      46      {
      47        __asm__ volatile ("");
      48        if (b[i] != i+5)
      49  	abort ();
      50      }
      51  }
      52  
      53  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
      54  /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 1 "vect" } } */