[all-commits] [llvm/llvm-project] 042a7a: [riscv] Use X0 for destination of VSETVLI instruct...

Philip Reames via All-commits all-commits at lists.llvm.org
Thu May 5 07:40:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 042a7a5f0da8beb89cbbfe2f1c3a155e654d9375
      https://github.com/llvm/llvm-project/commit/042a7a5f0da8beb89cbbfe2f1c3a155e654d9375
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-05-05 (Thu, 05 May 2022)

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

  Log Message:
  -----------
  [riscv] Use X0 for destination of VSETVLI instruction if result unused

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, many 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 for fixed length vectorization. (vscale vectorization generally uses the GPR result to know how far to e.g. advance pointers in a loop and these uses are not removed.)  When inserting VSETVLIs to lower psuedos, we prefer the X0 form anyways.

Differential Revision: https://reviews.llvm.org/D124961




More information about the All-commits mailing list