diff options
author | Luke Lau <luke@igalia.com> | 2025-02-12 12:06:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-12 12:06:55 +0800 |
commit | cc7e83601d759349b0ded7d75b5550f3c625dfcf (patch) | |
tree | 0cfce4b9b24b163dc5c7cac76bb2e3a7f2b4853c /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | acd34d90d3acd9dd260fdb93c54f70c222e26875 (diff) | |
download | llvm-cc7e83601d759349b0ded7d75b5550f3c625dfcf.zip llvm-cc7e83601d759349b0ded7d75b5550f3c625dfcf.tar.gz llvm-cc7e83601d759349b0ded7d75b5550f3c625dfcf.tar.bz2 |
[RISCV] Select mask operands as virtual registers and eliminate uses of vmv0 (#125026)
This is another attempt at #88496 to keep mask operands in SSA after
instruction selection.
Previously we selected the mask operands into vmv0, a singleton register
class with exactly one register, V0.
But the register allocator doesn't really support singleton register
classes and we ran into errors like "ran out of registers during
register allocation in function".
This avoids this by introducing a pass just before register allocation
that converts any use of vmv0 to a copy to $v0, i.e. what isel currently
does today.
That way the register allocator doesn't need to deal with the singleton
register class, but we get the benefits of having the mask registers in
SSA throughout the backend:
- This allows RISCVVLOptimizer to reduce the VLs of instructions that
define mask registers
- It enables CSE and code sinking in more places
- It removes the need to peek through mask copies in RISCVISelDAGToDAG
and keep track of V0 defs in RISCVVectorPeephole
This patch initially eliminates uses of vmv0s after RISCVVectorPeephole
to keep the diff to a minimum, and a follow up patch will move it past
the other MachineInstr SSA passes.
Note that it doesn't try to remove any defs of vmv0 as we shouldn't have
any instructions that have any vmv0 outputs.
As a further follow up, we can move the elimination pass to after phi
elimination and outside of SSA, which would unblock the pre-RA scheduler
around masked pseudos. This might also help the issue that
RISCVVectorMaskDAGMutation tries to solve.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions