[PATCH] D124961: [riscv] Use X0 for destination of VSETVLI instruction if result unused

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 13:45:15 PDT 2022


reames created this revision.
reames added reviewers: craig.topper, khchen, Chenbing.Zheng, jacquesguan.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

If the GPR destination register of a VSETVLI instruction is unused, we can replace it with X0.  This discards the result, and thus reduces register pressure.

Since after the core insertion/lowering algorithm has run, basically all user written VSETVLIs will have their GPR result unused (as VTYPE/VLEN is now explicitly read instead), this kicks in for most tests which involve a vsetvli intrinsic.  When inserting VSETVLIs to lower psuedos, we prefer the X0 form anyways.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124961

Files:
  llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
  llvm/test/CodeGen/RISCV/rvv/rv32-vsetvli-intrinsics.ll
  llvm/test/CodeGen/RISCV/rvv/rv64-vsetvli-intrinsics.ll
  llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
  llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir
  llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll
  llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124961.427120.patch
Type: text/x-patch
Size: 9944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220504/edf57d6d/attachment.bin>


More information about the llvm-commits mailing list