How to inhibit jump table range check

I am working on a back end for an architecture whose jump via table instruction includes the range check. Therefore I don't need the range check generated (in SelectionDAGBuilder ?).

There appears to be a struct JumpTableHeader which contains a field OmitRangeCheck which, when true, does what I want. However, there doesn't appear to be a mechanism for a back end to set it.

Anyone have any ideas?


Hi Brian,

I actually solved this exact problem for the upstream WebAssembly backend in the last couple of weeks. I was originally going to use the OmitRangeCheck field, but after prompting from my reviewers on I ended up removing the range checks in the backend instead. You can see the pass I added to do that here: I think it probably wouldn’t be too hard to adapt that pass to a different backend, but feel free to reach out if you have any questions about it!



Thank you for your prompt reply. I will take a look at what you have done and hopefully it will work for me. I would have preferred to eliminate the range check at the point where it was generated instead of adding a pass later to eliminate it. But I guess we have to live with what ever the implementers of the two major architectures allow us to do.