[llvm] [RISCV] Move RISCVInsertVSETVLI to after phi elimination (PR #91440)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Sun May 12 20:58:37 PDT 2024
================
@@ -1661,9 +1708,17 @@ void RISCVInsertVSETVLI::insertReadVL(MachineBasicBlock &MBB) {
if (RISCV::isFaultFirstLoad(MI)) {
Register VLOutput = MI.getOperand(1).getReg();
assert(VLOutput.isVirtual());
- if (!MRI->use_nodbg_empty(VLOutput))
- BuildMI(MBB, I, MI.getDebugLoc(), TII->get(RISCV::PseudoReadVL),
- VLOutput);
+ if (!MI.getOperand(1).isDead()) {
+ auto ReadVLMI = BuildMI(MBB, I, MI.getDebugLoc(),
+ TII->get(RISCV::PseudoReadVL), VLOutput);
+ // Move the LiveInterval's definition down to PseudoReadVL.
+ SlotIndex NewDefSI =
+ LIS->InsertMachineInstrInMaps(*ReadVLMI).getRegSlot();
+ LiveInterval &DefLI = LIS->getInterval(VLOutput);
----------------
lukel97 wrote:
I gave this a try but it looks like there isn't any new value number created, i.e. ReadVLMI has the same value number as MI.
https://github.com/llvm/llvm-project/pull/91440
More information about the llvm-commits
mailing list