Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-10.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 {
11 if (argc != 2)
12 {
13 if (argc == 3)
14 {
15 foo ();
16 foo ();
17 }
18 else if (argc == 4)
19 {
20 foo ();
21 }
22 else if (argc == 5)
23 {
24 global = 2;
25 }
26 else
27 global -= 123;
28 }
29 else
30 {
31 global += 1;
32 }
33 }
34 else
35 foo ();
36
37
38 global -= 12;
39 return 0;
40 }
41
42 /* { dg-final { scan-tree-dump "Canonical GIMPLE case clusters: 1 2 3 4 5" "iftoswitch" } } */
43 /* { dg-final { scan-tree-dump "Condition chain with \[^\n\r]\* BBs transformed into a switch statement." "iftoswitch" } } */
44