Skip to content

Commit d621e74

Browse files
committed
[RISCV] Rematerialize vmv.s.x and vfmv.s.f
Continuing with llvm#107993 and llvm#108007, this handles the last of the main rematerializable vector instructions. Program regalloc.NumSpills regalloc.NumReloads regalloc.NumRemats lhs rhs diff lhs rhs diff lhs rhs diff 508.namd_r 6598.00 6598.00 0.0% 15509.00 15509.00 0.0% 2387.00 2387.00 0.0% 505.mcf_r 141.00 141.00 0.0% 372.00 372.00 0.0% 36.00 36.00 0.0% 641.leela_s 356.00 356.00 0.0% 525.00 525.00 0.0% 117.00 117.00 0.0% 631.deepsjeng_s 353.00 353.00 0.0% 682.00 682.00 0.0% 124.00 124.00 0.0% 623.xalancbmk_s 1548.00 1548.00 0.0% 2466.00 2466.00 0.0% 620.00 620.00 0.0% 620.omnetpp_s 946.00 946.00 0.0% 1485.00 1485.00 0.0% 1178.00 1178.00 0.0% 605.mcf_s 141.00 141.00 0.0% 372.00 372.00 0.0% 36.00 36.00 0.0% 557.xz_r 289.00 289.00 0.0% 505.00 505.00 0.0% 172.00 172.00 0.0% 541.leela_r 356.00 356.00 0.0% 525.00 525.00 0.0% 117.00 117.00 0.0% 531.deepsjeng_r 353.00 353.00 0.0% 682.00 682.00 0.0% 124.00 124.00 0.0% 520.omnetpp_r 946.00 946.00 0.0% 1485.00 1485.00 0.0% 1178.00 1178.00 0.0% 523.xalancbmk_r 1548.00 1548.00 0.0% 2466.00 2466.00 0.0% 620.00 620.00 0.0% 619.lbm_s 68.00 68.00 0.0% 70.00 70.00 0.0% 1.00 1.00 0.0% 519.lbm_r 73.00 73.00 0.0% 75.00 75.00 0.0% 1.00 1.00 0.0% 657.xz_s 289.00 289.00 0.0% 505.00 505.00 0.0% 172.00 172.00 0.0% 511.povray_r 1937.00 1936.00 -0.1% 3629.00 3628.00 -0.0% 517.00 518.00 0.2% 502.gcc_r 12450.00 12442.00 -0.1% 27328.00 27317.00 -0.0% 9409.00 9409.00 0.0% 602.gcc_s 12450.00 12442.00 -0.1% 27328.00 27317.00 -0.0% 9409.00 9409.00 0.0% 638.imagick_s 4181.00 4178.00 -0.1% 11342.00 11338.00 -0.0% 3366.00 3368.00 0.1% 538.imagick_r 4181.00 4178.00 -0.1% 11342.00 11338.00 -0.0% 3366.00 3368.00 0.1% 500.perlbench_r 4178.00 4175.00 -0.1% 9162.00 9159.00 -0.0% 2410.00 2410.00 0.0% 600.perlbench_s 4178.00 4175.00 -0.1% 9162.00 9159.00 -0.0% 2410.00 2410.00 0.0% 525.x264_r 1886.00 1884.00 -0.1% 4561.00 4559.00 -0.0% 471.00 471.00 0.0% 625.x264_s 1886.00 1884.00 -0.1% 4561.00 4559.00 -0.0% 471.00 471.00 0.0% 510.parest_r 42740.00 42689.00 -0.1% 82400.00 82252.00 -0.2% 5612.00 5620.00 0.1% 644.nab_s 753.00 752.00 -0.1% 1183.00 1182.00 -0.1% 318.00 318.00 0.0% 544.nab_r 753.00 752.00 -0.1% 1183.00 1182.00 -0.1% 318.00 318.00 0.0% 526.blender_r 13105.00 13084.00 -0.2% 26478.00 26442.00 -0.1% 18991.00 18989.00 -0.0% Geomean difference -0.0% -0.0% 0.0% 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 cf8ee28 commit d621e74

File tree

4 files changed

+428
-370
lines changed

4 files changed

+428
-370
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ Register RISCVInstrInfo::isStoreToStackSlot(const MachineInstr &MI,
169169
bool RISCVInstrInfo::isReallyTriviallyReMaterializable(
170170
const MachineInstr &MI) const {
171171
switch (RISCV::getRVVMCOpcode(MI.getOpcode())) {
172+
case RISCV::VMV_S_X:
173+
case RISCV::VFMV_S_F:
172174
case RISCV::VMV_V_I:
173175
case RISCV::VID_V:
174176
if (MI.getOperand(1).isUndef() &&

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6762,7 +6762,7 @@ let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in {
67626762
Pseudo<(outs GPR:$rd), (ins VR:$rs2, ixlenimm:$sew), []>,
67636763
Sched<[WriteVMovXS, ReadVMovXS]>,
67646764
RISCVVPseudo;
6765-
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VMV_S_X,
6765+
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VMV_S_X, isReMaterializable = 1,
67666766
Constraints = "$rd = $rs1" in
67676767
def PseudoVMV_S_X: Pseudo<(outs VR:$rd),
67686768
(ins VR:$rs1, GPR:$rs2, AVL:$vl, ixlenimm:$sew),
@@ -6785,7 +6785,7 @@ let mayLoad = 0, mayStore = 0, hasSideEffects = 0 in {
67856785
(ins VR:$rs2, ixlenimm:$sew), []>,
67866786
Sched<[WriteVMovFS, ReadVMovFS]>,
67876787
RISCVVPseudo;
6788-
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VFMV_S_F,
6788+
let HasVLOp = 1, HasSEWOp = 1, BaseInstr = VFMV_S_F, isReMaterializable = 1,
67896789
Constraints = "$rd = $rs1" in
67906790
def "PseudoVFMV_S_" # f.FX :
67916791
Pseudo<(outs VR:$rd),

0 commit comments

Comments
 (0)