http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54505
--- Comment #4 from Avi Kivity <avi at redhat dot com> 2012-09-09 11:12:53 UTC --- (In reply to comment #2) > I don't think this transformation would always be an improvement. gcc should make the transformation when it improves the code (like all other transformations). > Had a > developer wanted to use a switch, I'd think he/she would have used one. A > dispatch table is much more code-size efficient compared to a switch. gcc often transforms a switch to a dispatch table, with the difference that the function call convention is not used. Instead, register values are maintained across the call, and instead of call/ret, jmp/jmp (on x86) are used. gcc should allow the programmer to write the code in the cleanest way, and transform it to the most performing way. In the same way that gcc converts some multiplies to a shift, it should convert some indirect function calls to a non-function dispatch table. It's inlining but on a larger scale.