aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
diff options
context:
space:
mode:
authorLuke Lau <luke@igalia.com>2025-09-12 14:21:54 +0800
committerGitHub <noreply@github.com>2025-09-12 06:21:54 +0000
commit4bb250d6a3d63c41f5d539c9b9a162070ea5b619 (patch)
tree3366af4fffee174438e7d1de298cf098d20dd690 /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
parent73cfd45e3401b18730e283b8a13e21fb85de3a38 (diff)
downloadllvm-4bb250d6a3d63c41f5d539c9b9a162070ea5b619.zip
llvm-4bb250d6a3d63c41f5d539c9b9a162070ea5b619.tar.gz
llvm-4bb250d6a3d63c41f5d539c9b9a162070ea5b619.tar.bz2
[VPlan] Always consider register pressure on RISC-V (#156951)
Stacked on #156923 In https://godbolt.org/z/8svWaredK, we spill a lot on RISC-V because whilst the largest element type is i8, we generate a bunch of pointer vectors for gathers and scatters. This means the VF chosen is quite high e.g. <vscale x 16 x i8>, but we end up using a bunch of <vscale x 16 x i64> m8 registers for the pointers. This was briefly fixed by #132190 where we computed register pressure in VPlan and used it to prune VFs that were likely to spill. The legacy cost model wasn't able to do this pruning because it didn't have visibility into the pointer vectors that were needed for the gathers/scatters. However VF pruning was restricted again to just the case when max bandwidth was enabled in #141736 to avoid an AArch64 regression, and restricted again in #149056 to only prune VFs that had max bandwidth enabled. On RISC-V we take advantage of register grouping for performance and choose a default of LMUL 2, which means there are 16 registers to work with – half the number as SVE, so we encounter higher register pressure more frequently. As such, we likely want to always consider pruning VFs with high register pressure and not just the VFs from max bandwidth. This adds a TTI hook to opt into this behaviour for RISC-V which fixes the motivating godbolt example above. When last checked this significantly reduces the number of spills on SPEC CPU 2017, up to 80% on 538.imagick_r.
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions