diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-02-23 20:40:13 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-02-23 20:40:13 +0000 |
commit | da2295e631ae07788f7db53efa3bea6367e7656c (patch) | |
tree | 2fed9a6f0dc348a58c93a7b93ff9ceebbb11472c | |
parent | 2a27a7598b90359696e31cb665914206f369d1f0 (diff) |
Handle cases when joining live intervals of two virtual registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34534 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index f03830ab1d..ce2e4290b1 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -960,21 +960,31 @@ bool LiveIntervals::JoinCopy(MachineInstr *CopyMI, DOUT << "\n\t\tJoined. Result = "; DestInt.print(DOUT, mri_); DOUT << "\n"; - // If the intervals were swapped by Join, swap them back so that the register - // mapping (in the r2i map) is correct. - if (Swapped) SrcInt.swap(DestInt); - // Live range has been lengthened due to colaescing, eliminate the // unnecessary kills at the end of the source live ranges. - LiveVariables::VarInfo& vi = lv_->getVarInfo(repSrcReg); - for (unsigned i = 0, e = vi.Kills.size(); i != e; ++i) { - MachineInstr *Kill = vi.Kills[i]; + LiveVariables::VarInfo& svi = lv_->getVarInfo(repSrcReg); + for (unsigned i = 0, e = svi.Kills.size(); i != e; ++i) { + MachineInstr *Kill = svi.Kills[i]; if (Kill == CopyMI || isRemoved(Kill)) continue; if (DestInt.liveAt(getInstructionIndex(Kill) + InstrSlots::NUM)) unsetRegisterKill(Kill, repSrcReg); } + if (MRegisterInfo::isVirtualRegister(repDstReg)) { + // If both are virtual registers... + LiveVariables::VarInfo& dvi = lv_->getVarInfo(repDstReg); + for (unsigned i = 0, e = dvi.Kills.size(); i != e; ++i) { + MachineInstr *Kill = dvi.Kills[i]; + if (Kill == CopyMI || isRemoved(Kill)) + continue; + if (DestInt.liveAt(getInstructionIndex(Kill) + InstrSlots::NUM)) + unsetRegisterKill(Kill, repDstReg); + } + } + // If the intervals were swapped by Join, swap them back so that the register + // mapping (in the r2i map) is correct. + if (Swapped) SrcInt.swap(DestInt); removeInterval(repSrcReg); r2rMap_[repSrcReg] = repDstReg; |