https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70861
--- Comment #3 from Wilco <wdijkstr at arm dot com> --- (In reply to Andrew Pinski from comment #2) > Note I think if we had gotos instead of assignment here we should do the > similar thing for the switch table itself. Absolutely, that was my point. > Note also the assignment to i is getting in the way for the switch to > constant table form. In SSA form you can sink the assignments into a shared block, so it should be able deal with an identical assignment to a global, pointer, array or even returning directly. Also it's common that the default or a few other cases are doing something different, so those need to be pulled out separately. However that's icing on the cake - the key issue is that GCC doesn't even do the basic stuff yet. Most compilers are able to split off cases with high profile counts, dense switch tables, ranges that all go to the same block etc.