https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71520
Bug ID: 71520 Summary: Missing cross-jumping of switch cases Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- As mentioned in PR71373, for switch cases we have various issues. One is that tree cross-jumping fails to handle bbs with labels, therefore anything that is successfor of GIMPLE_SWITCH. Another one is that the switchconv pass runs very early, before we could do any cross-jumping, and therefore often decides to use inefficient table or bitmask lowering, even when it could do better if it knew some cases can be cross-jumped. For the first issue, testcase is e.g. void bar (int); void foo (int x) { switch (x) { case 1: case 12: case 28: case 174: bar (1); bar (2); break; case 3: case 7: case 78: case 96: case 121: default: bar (3); bar (4); bar (5); bar (6); break; case 8: case 13: case 27: case 19: case 118: bar (3); bar (4); bar (5); bar (6); break; case 4: bar (7); break; } }