[llvm] [RISCV] Let LiveIntervals::shrinkToUses compute dead AVLs (PR #90629)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 23:30:14 PDT 2024


================
@@ -1648,17 +1648,9 @@ bool RISCVCoalesceVSETVLI::coalesceVSETVLIs(MachineBasicBlock &MBB) {
           if (NextMI->getOperand(1).isReg())
             NextMI->getOperand(1).setReg(RISCV::NoRegister);
 
-          if (OldVLReg && OldVLReg.isVirtual()) {
-            // NextMI no longer uses OldVLReg so shrink its LiveInterval.
-            LIS->shrinkToUses(&LIS->getInterval(OldVLReg));
-
-            MachineInstr *VLOpDef = MRI->getUniqueVRegDef(OldVLReg);
-            if (VLOpDef && TII->isAddImmediate(*VLOpDef, OldVLReg) &&
-                MRI->use_nodbg_empty(OldVLReg)) {
-              VLOpDef->eraseFromParent();
-              LIS->removeInterval(OldVLReg);
-            }
-          }
+          // NextMI no longer uses OldVLReg so shrink its LiveInterval.
+          if (OldVLReg && OldVLReg.isVirtual())
+            LIS->shrinkToUses(&LIS->getInterval(OldVLReg), &ToDelete);
----------------
lukel97 wrote:

This PR should now perform the same checks as LiveRangeEdit::eliminateDeadDef (isn't bundled, isn't asm, isSafeToMove)

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


More information about the llvm-commits mailing list