https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #4) > Note that this is good for identity, but we could also turn a map 0->3, > 1->4, 5->8 into x->x+3, or generally any map (with an unreachable default > case) into a polynomial (or some other simple function), the cost of which > might be higher or lower than the jump table. It probably isn't worth going > too far in that direction though. Sure, it's also described here: https://docs.google.com/viewer?url=https%3A%2F%2Fpdfs.semanticscholar.org%2F9269%2F51f0f3e5d67d8ea2bf7b7bca4c5e7de3dafc.pdf%23page%3D103 It's a bit different as it handles situations like switch (x) case 16: case 32: ... where one should perform operation to index to have a consecutive jump table. But it touches similar.