[llvm] [RISCV] Let LiveIntervals::shrinkToUses compute dead immediates. NFC (PR #90629)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Sun May 5 21:05:47 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:
Yeah, looks like RegisterCoalescer is the main user of this which eventually passes the dead instructions to `LiveRangeEdit::eliminateDeadDefs`, which in turn checks for bundles, inline asm and isSafeToMove
https://github.com/llvm/llvm-project/pull/90629
More information about the llvm-commits
mailing list