[llvm] AMDGPU: Update live intervals in convertToThreeAddress (PR #104610)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 05:50:07 PDT 2024
================
@@ -3947,14 +3947,32 @@ MachineInstr *SIInstrInfo::convertToThreeAddress(MachineInstr &MI,
(ST.getConstantBusLimit(Opc) > 1 || !Src0->isReg() ||
!RI.isSGPRReg(MBB.getParent()->getRegInfo(), Src0->getReg()))) {
MachineInstr *DefMI;
- const auto killDef = [&]() -> void {
+ const auto killDef = [&](SlotIndex NewIdx) -> void {
const MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo();
// The only user is the instruction which will be killed.
Register DefReg = DefMI->getOperand(0).getReg();
+
+ if (LIS) {
+ LiveInterval &DefLI = LIS->getInterval(DefReg);
+ LiveRange::Segment *OldSeg = DefLI.getSegmentContaining(NewIdx);
+
+ if (OldSeg->end == NewIdx.getRegSlot()) {
+ DefLI.removeSegment(OldSeg->start, NewIdx.getRegSlot(), true);
----------------
arsenm wrote:
We should actually be trimming the segment, we still want to leave the dead def behind
https://github.com/llvm/llvm-project/pull/104610
More information about the llvm-commits
mailing list