[RISCV] Improve register allocation around vector masks
authorFraser Cormack <fraser@codeplay.com>
Fri, 19 Feb 2021 15:54:40 +0000 (15:54 +0000)
committerFraser Cormack <fraser@codeplay.com>
Sat, 20 Feb 2021 14:47:51 +0000 (14:47 +0000)
commit9aa20caee6b47ac601602c674749fb6c1d2179cf
treed222567a25eb7342ad84f3cfdf9e585432eb3683
parent4550fdff2b2eec15143fac536e41ce967e522a3a
[RISCV] Improve register allocation around vector masks

With vector mask registers only allocatable to V0 (VMV0Regs) it is
relatively simple to generate code which uses multiple masks and naively
requires spilling.

This patch aims to improve codegen in such cases by telling LLVM it can
use VRRegs to hold masks. This will prevent spilling in many cases by
having LLVM copy to an available VR register.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D97055
llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
llvm/lib/Target/RISCV/RISCVRegisterInfo.h
llvm/test/CodeGen/RISCV/rvv/mask-reg-alloc.mir