[llvm] [RISCV] Let LiveIntervals::shrinkToUses compute dead immediate. NFC (PR #90629)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 10:23:15 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Luke Lau (lukel97)
<details>
<summary>Changes</summary>
We can simplify removing dead AVL immediates > 31 by using the dead argument to shrinkToUses, since it will already compute dead values.
---
Full diff: https://github.com/llvm/llvm-project/pull/90629.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp (+3-11)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 216dc78085204e..f4ff17f7b65585 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -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);
MI.setDesc(NextMI->getDesc());
}
MI.getOperand(2).setImm(NextMI->getOperand(2).getImm());
``````````
</details>
https://github.com/llvm/llvm-project/pull/90629
More information about the llvm-commits
mailing list