This patch enables jump table lowering in the RISC-V backend.
In addition to the test case included, the new lowering was
tested by compiling the OCaml runtime and running it under qemu.
Differential D92097
[RISCV] Basic jump table lowering nand on Nov 25 2020, 6:01 AM. Authored by
Details
This patch enables jump table lowering in the RISC-V backend. In addition to the test case included, the new lowering was
Diff Detail
Event Timeline
Comment Actions @nand thank you for this patch, it's been something missing from the RISC-V backend for a while, which is why you're getting so much feedback so quickly.
Comment Actions Is there anything I could do to test the impact on code size? As I mentioned previously, in my setting I cannot easily turn the use of jump tables off. Are there any binaries that are relatively easy to cross compile and are of interest? Comment Actions There was a previous patch which had some feedback about thresholds: https://reviews.llvm.org/D48430 Comment Actions Cool. I think we can tweak the threshold later, but this should start us in a reasonable place. Thanks for your patience, I'm happy for this to land. The previous discussion pointed out that GCC's default threshold on RISC-V was 5 (thanks @kito-cheng for the link). We match that here, so that should avoid the worst of the performance regressions. Comment Actions I agree with @lenary, I think this is fine to land (with the whitespace fix :)) and if it turns out the threshold is too low then we'll soon find out and can adjust accordingly (but I imagine not, 5 feels like a sensible default). Or if it's too high!
|
Let's make sure this doesn't have a major code size impact. I'm not sure the threshold GCC uses, something like 3 IIRC?
The problem for code size is that the sequence to hold the jump table and the calculate the jump index is longer than a chain of ifs, if there aren't too many entries.