This patch adds a pass after branch relaxation to check whether the span of jump tables is small enough that the offsets can be encoded in 8 or 16-bits and emit appropriate sequences if so.
This improves the binary size quite significantly for some tests (it turns out not a single table in the test-suite needs 32-bits of range, and two thirds only need 8-bits).
I'm a little divided on when to enable this and whether to continue to support 64-bit absolute entries (the code sequence is slightly simpler). In the end I decided to go for simplicity on the grounds that switches probably aren't performance critical and will probably be dominated by mispredicts anyway. I'd be open to gating it on MinSize or something though.
What do you think?
Range-based for loop here.