Previously, the generation of jumptables was disabled. This patch adds the necessary support, as reflected in the updated output in test/CodeGen/RISCV/jumptable.ll.
Diff Detail
Event Timeline
lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
153 | Alex, I see lower performance when creating jump tables. We might need to set a minimum JT entries value to avoid the degradation. |
GCC using 5 as threshold to decide using jump table or not for RISC-V and LLVM using 4.
Reference:
GCC: https://github.com/gcc-mirror/gcc/blob/master/gcc/targhooks.c#L1628
- Note: targetm.have_casesi () return false for RISC-V.
LLVM: https://github.com/llvm-mirror/llvm/blob/master/lib/CodeGen/TargetLoweringBase.cpp#L72
Alex, we have not yet merged this patch. We should merge it and we can leave the default as GCC.
This makes our code size gap with GCC smaller.
In the past I did see degradation in some SiFive hardware (I think it was on HiFive1 board). Maybe some of the SiFive colleagues can look at it at some point.
lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
375 | I'm not sure we should merge this without support for position independent code. |
Alex, I see lower performance when creating jump tables. We might need to set a minimum JT entries value to avoid the degradation.