aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-7.c
blob: 4a176f1a613fc50806879ed058fff73c9b5d3d5b (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-iftoswitch-optimized" } */

int global;

int foo(int a)
{
  int x = 0;
  for (unsigned i = 0; i < a; i++)
  {
    if (a == 2)
    {
      global += 123;
      x = 1;
    }
    else if (a == 3)
      x = 2;
    else if (a == 10)
      x = 3;
  }

  return x;
}

/* { dg-final { scan-tree-dump-not "Condition chain " "iftoswitch" } } */