Fix liveintervals handling of dbg_value instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98686 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2010-03-16 21:51:27 +00:00
parent bb6c77e6b9
commit 4507f089d4
2 changed files with 28 additions and 9 deletions

View File

@ -141,7 +141,7 @@ void LiveIntervals::printInstrs(raw_ostream &OS) const {
for (MachineBasicBlock::iterator mii = mbbi->begin(),
mie = mbbi->end(); mii != mie; ++mii) {
if (mii->isDebugValue())
OS << SlotIndex::getEmptyKey() << '\t' << *mii;
OS << " \t" << *mii;
else
OS << getInstructionIndex(mii) << '\t' << *mii;
}
@ -583,6 +583,16 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB,
// Look for kills, if it reaches a def before it's killed, then it shouldn't
// be considered a livein.
MachineBasicBlock::iterator mi = MBB->begin();
MachineBasicBlock::iterator E = MBB->end();
// Skip over DBG_VALUE at the start of the MBB.
if (mi != E && mi->isDebugValue()) {
while (++mi != E && mi->isDebugValue())
;
if (mi == E)
// MBB is empty except for DBG_VALUE's.
return;
}
SlotIndex baseIndex = MIIdx;
SlotIndex start = baseIndex;
if (getInstructionFromIndex(baseIndex) == 0)
@ -591,12 +601,7 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB,
SlotIndex end = baseIndex;
bool SeenDefUse = false;
MachineBasicBlock::iterator E = MBB->end();
while (mi != E) {
while (mi != E && mi->isDebugValue())
++mi;
if (mi == E)
break;
if (mi->killsRegister(interval.reg, tri_)) {
DEBUG(dbgs() << " killed");
end = baseIndex.getDefIndex();
@ -613,10 +618,11 @@ void LiveIntervals::handleLiveInRegister(MachineBasicBlock *MBB,
break;
}
++mi;
if (mi != E && !mi->isDebugValue()) {
while (++mi != E && mi->isDebugValue())
// Skip over DBG_VALUE.
;
if (mi != E)
baseIndex = indexes_->getNextNonNullIndex(baseIndex);
}
}
// Live-in register might not be used at all.

View File

@ -0,0 +1,13 @@
; RUN: llc < %s
; rdar://7759395
%0 = type { i32, i32 }
define void @t(%0*, i32, i32, i32, i32) nounwind {
tail call void @llvm.dbg.value(metadata !{%0* %0}, i64 0, metadata !0)
unreachable
}
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!0 = metadata !{i32 0} ;