A couple of kill marker maintainence bug.

llvm-svn: 48653
This commit is contained in:
Evan Cheng 2008-03-21 19:09:30 +00:00
parent 3819e559c9
commit 32a6116ffd
2 changed files with 5 additions and 1 deletions

View File

@ -432,6 +432,7 @@ SimpleRegisterCoalescing::UpdateRegDefsUses(unsigned SrcReg, unsigned DstReg,
for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg),
E = mri_->reg_end(); I != E; ) {
MachineOperand &O = I.getOperand();
MachineInstr *UseMI = &*I;
++I;
if (DstIsPhys) {
unsigned UseSubIdx = O.getSubReg();
@ -451,6 +452,9 @@ SimpleRegisterCoalescing::UpdateRegDefsUses(unsigned SrcReg, unsigned DstReg,
assert(OldSubIdx < SubIdx && "Conflicting sub-register index!");
else if (SubIdx)
O.setSubReg(SubIdx);
// Remove would-be duplicated kill marker.
if (O.isKill() && UseMI->killsRegister(DstReg))
O.setIsKill(false);
O.setReg(DstReg);
}
}

View File

@ -610,7 +610,7 @@ static void UpdateKills(MachineInstr &MI, BitVector &RegKills,
if (Reg == 0)
continue;
if (RegKills[Reg]) {
if (RegKills[Reg] && KillOps[Reg]->getParent() != &MI) {
// That can't be right. Register is killed but not re-defined and it's
// being reused. Let's fix that.
KillOps[Reg]->setIsKill(false);