[llvm] [RISCV] Move RISCVInsertVSETVLI to after phi elimination (PR #91440)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 08:07:42 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);
----------------
preames wrote:

I think this might be MergeValueNumberInto?

https://github.com/llvm/llvm-project/pull/91440


More information about the llvm-commits mailing list