[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Evan Cheng
evan.cheng at apple.com
Fri Feb 23 12:40:32 PST 2007
Changes in directory llvm/lib/CodeGen:
LiveIntervalAnalysis.cpp updated: 1.212 -> 1.213
---
Log message:
Handle cases when joining live intervals of two virtual registers.
---
Diffs of the changes: (+17 -7)
LiveIntervalAnalysis.cpp | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.212 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.213
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.212 Thu Feb 22 17:03:39 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Feb 23 14:40:13 2007
@@ -960,21 +960,31 @@
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;
More information about the llvm-commits
mailing list