Don't assume that an instruction ending a register's live range always reads

the register; it may be a dead def instead. Fixes PR8820.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122218 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Cameron Zwarich 2010-12-20 01:22:37 +00:00
parent 39ffcb7b62
commit 636f15ff04

View File

@ -1072,10 +1072,24 @@ void MachineVerifier::verifyLiveIntervals() {
<< MBBStartIdx << '\n'; << MBBStartIdx << '\n';
} else if (TargetRegisterInfo::isVirtualRegister(LI.reg) && } else if (TargetRegisterInfo::isVirtualRegister(LI.reg) &&
!MI->readsVirtualRegister(LI.reg)) { !MI->readsVirtualRegister(LI.reg)) {
// FIXME: Should we require a kill flag? // A live range can end with either a redefinition, a kill flag on a
report("Instruction killing live segment doesn't read register", MI); // use, or a dead flag on a def.
I->print(*OS); // FIXME: Should we check for each of these?
*OS << " in " << LI << '\n'; bool hasDeadDef = false;
for (MachineInstr::const_mop_iterator MOI = MI->operands_begin(),
MOE = MI->operands_end(); MOI != MOE; ++MOI) {
if (MOI->isReg() && MOI->isDef() && MOI->isDead()) {
hasDeadDef = true;
break;
}
}
if (!hasDeadDef) {
report("Instruction killing live segment neither defines nor reads "
"register", MI);
I->print(*OS);
*OS << " in " << LI << '\n';
}
} }
} }