Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-iftoswitch-optimized --param case-values-threshold=5" } */
3
4 int global;
5 int foo ();
6
7 int main(int argc, char **argv)
8 {
9 if (argc == 1)
10 foo ();
11 else if (argc == 2)
12 {
13 global += 1;
14 }
15 else if (argc == 3)
16 {
17 foo ();
18 foo ();
19 }
20 else if (argc == 4)
21 {
22 foo ();
23 }
24 else if (argc == 5)
25 {
26 global = 2;
27 }
28 else
29 global -= 123;
30
31 global -= 12;
32 return 0;
33 }
34
35 /* { dg-final { scan-tree-dump "Condition chain with \[^\n\r]\* BBs transformed into a switch statement." "iftoswitch" } } */