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? Thanks, brian
Thomas Lively via llvm-dev
2020-Jun-20 05:52 UTC
[llvm-dev] How to inhibit jump table range check
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 https://reviews.llvm.org/D80778 I ended up removing the range checks in the backend instead. You can see the pass I added to do that here: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp 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! Best, Thomas On Fri, Jun 19, 2020 at 12:55 PM Bagel via llvm-dev <llvm-dev at lists.llvm.org> wrote:> 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? > > Thanks, > brian > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200619/5c55e1af/attachment.html>
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. Regards, brian On 6/20/20 12:52 AM, Thomas Lively wrote:> 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 > https://reviews.llvm.org/D80778 I ended up removing the range checks in the > backend instead. You can see the pass I added to do that here: > https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp 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! > > Best, > > Thomas > > On Fri, Jun 19, 2020 at 12:55 PM Bagel via llvm-dev <llvm-dev at lists.llvm.org > <mailto:llvm-dev at lists.llvm.org>> wrote: > > 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? > > Thanks, > brian > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >