On Wed, Jun 29, 2011 at 9:14 PM, Ian Lance Taylor <i...@google.com> wrote: > "Marcin J." <trashyan...@wp.pl> writes: > >> will be possible to add optimization that merge this two (or more) switch in >> one big one (even if inner one is from inline function?) and then use one >> jump table for both switches? > > Is it possible? Sure. It's quite a special case, though, so if it's > enabled by default it would have to be really fast. Fortunately it's > easy to find switch statements as they will be the last statement in a > basic block. See gcc/tree-switch-conversion.c for ideas on how to > approach this.
I think even cfgcleanup could do this merging if the switch indexes are literally the same and the default case block only contains the nested switch stmt. Richard. > Ian >