summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/loop-versioning-11.c
blob: 77ff484a4c2278f550a4ea1280f2e7e6509cda0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-options "-O3 -fdump-tree-lversion-details" } */

/* Test that we don't try to version for something that is never 1.  */

void
f1 (double *x, int stepx, int n)
{
  if (stepx == 1)
    for (int i = 0; i < n; ++i)
      x[i] = 100;
  else
    for (int i = 0; i < n; ++i)
      x[stepx * i] = 100;
}

void
f2 (double *x, int stepx, int n)
{
  if (stepx <= 1)
    for (int i = 0; i < n; ++i)
      x[i] = 100;
  else
    for (int i = 0; i < n; ++i)
      x[stepx * i] = 100;
}

/* { dg-final { scan-tree-dump-times {want to version containing loop} 2 "lversion" } } */
/* { dg-final { scan-tree-dump-times {can never be 1} 2 "lversion" } } */
/* { dg-final { scan-tree-dump-not {versioned} "lversion" } } */