Skip to content

Commit 933fc63

Browse files
authored
[RISCV] Rematerialize vmv.s.x and vfmv.s.f (#108012)
Continuing with #107993 and #108007, this handles the last of the main rematerializable vector instructions. There's an extra spill in one of the test cases, but it's likely noise from the spill weights and isn't an issue in practice.
1 parent 21a0176 commit 933fc63

File tree

4 files changed

+464
-312
lines changed

4 files changed

+464
-312
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ bool RISCVInstrInfo::isReallyTriviallyReMaterializable(
172172
case RISCV::VMV_V_X:
173173
case RISCV::VFMV_V_F:
174174
case RISCV::VMV_V_I:
175+
case RISCV::VMV_S_X:
176+
case RISCV::VFMV_S_F:
175177
case RISCV::VID_V:
176178
if (MI.getOperand(1).isUndef() &&
177179
/* After RISCVInsertVSETVLI most pseudos will have implicit uses on vl

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6764,7 +6764,7 @@ let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in {
67646764
Pseudo<(outs GPR:$rd), (ins VR:$rs2, ixlenimm:$sew), []>,
67656765
Sched<[WriteVMovXS, ReadVMovXS]>,
67666766
RISCVVPseudo;
6767-
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VMV_S_X,
6767+
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VMV_S_X, isReMaterializable = 1,
67686768
Constraints = "$rd = $rs1" in
67696769
def PseudoVMV_S_X: Pseudo<(outs VR:$rd),
67706770
(ins VR:$rs1, GPR:$rs2, AVL:$vl, ixlenimm:$sew),
@@ -6787,7 +6787,7 @@ let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in {
67876787
(ins VR:$rs2, ixlenimm:$sew), []>,
67886788
Sched<[WriteVMovFS, ReadVMovFS]>,
67896789
RISCVVPseudo;
6790-
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VFMV_S_F,
6790+
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VFMV_S_F, isReMaterializable = 1,
67916791
Constraints = "$rd = $rs1" in
67926792
def "PseudoVFMV_S_" # f.FX :
67936793
Pseudo<(outs VR:$rd),

0 commit comments

Comments
 (0)