aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/loop-unswitch-17.c
blob: 8655e09a51c2f8cb86e2f240fc28985b674f129d (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
/* { dg-do compile } */
/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-optimized" } */

int foo (int a)
{
  do
    {
      if (a == 1)
        return 0;
      switch (a)
        {
        case 1:
          return 5;
        case 2:
          return 7;
        case 3:
          return 11;
        default:;
        }
    }
  while (1);
}

/* { dg-final { scan-tree-dump-times "unswitching loop" 3 "unswitch" } } */