gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-7.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-iftoswitch-optimized" } */ |
| 3 | |
| 4 | int global; |
| 5 | |
| 6 | int foo(int a) |
| 7 | { |
| 8 | int x = 0; |
| 9 | for (unsigned i = 0; i < a; i++) |
| 10 | { |
| 11 | if (a == 2) |
| 12 | { |
| 13 | global += 123; |
| 14 | x = 1; |
| 15 | } |
| 16 | else if (a == 3) |
| 17 | x = 2; |
| 18 | else if (a == 10) |
| 19 | x = 3; |
| 20 | } |
| 21 | |
| 22 | return x; |
| 23 | } |
| 24 | |
| 25 | /* { dg-final { scan-tree-dump-not "Condition chain " "iftoswitch" } } */ |