summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/vrp2.c
blob: 31909bdbf2409566b0949bcda7fb58d46bcbffbc (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
30
31
32
33
34
35
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-ipa-cp-details" } */

static __attribute__((noinline, noclone))
int foo (int i)
{
  if (i < 4)
    __builtin_abort ();
  return 0;
}

static __attribute__((noinline, noclone))
int bar (int j)
{
  if (j > 8)
    return foo (j + 2);
  else if (j > 2)
    return foo (j + 3);

  return 0;
}

int main ()
{
  foo (100);
  for (unsigned int i = 0; i < 12; ++i)
    {
      bar (i);
    }
  foo (4);
  return 0;
}

/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[4," "cp" } } */
/* { dg-final { scan-ipa-dump "Setting value range of param 0 \\(now 0\\) \\\[0, 11\\\]" "cp" } } */