aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c
blob: cdc57403c6edbe6e11fcafe44c05fcf1fe2b7e48 (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
36
37
38
39
40
41
42
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1-alias -fdump-tree-vrp2-alias" } */

void dead (unsigned n);
void alive (unsigned n);

void func (unsigned n, unsigned m)
{
  if (n == 0)
    __builtin_unreachable();
  if (n == 1)
    __builtin_unreachable();
  if (n & 0x1)
    __builtin_unreachable();
  if (n == 2)
    __builtin_unreachable();
  if (n == 3)
    __builtin_unreachable();
  if (n & 0x2)
    __builtin_unreachable();
  if (n == 4)
    __builtin_unreachable();
  if (n == 5)
    __builtin_unreachable();
  if (n & 0x4)
    __builtin_unreachable();
  if (n == 6)
    __builtin_unreachable();
  if (n == 7)
    __builtin_unreachable();
 if (n <8)
   dead (n);
 if (n != m)
    __builtin_unreachable();
 alive (n);
 alive (m);
}

/* { dg-final { scan-tree-dump-not "dead" "vrp1" } } */
/* { dg-final { scan-tree-dump-times "builtin_unreachable" 1 "vrp1" } } */
/* { dg-final { scan-tree-dump-not "builtin_unreachable" "vrp2" } } */
/* { dg-final { scan-tree-dump-times "fff8" 4 "vrp2" } } */