In DelayForLiveRegsBottomUp, handle instructions that read and write

the same physical register. Simplifies the fix from the previous
checkin r122211.

llvm-svn: 122370
This commit is contained in:
Andrew Trick 2010-12-21 22:27:44 +00:00
parent cff2764a6e
commit fbb3ed8774
1 changed files with 4 additions and 15 deletions

View File

@ -660,9 +660,12 @@ DelayForLiveRegsBottomUp(SUnit *SU, SmallVector<unsigned, 4> &LRegs) {
SmallSet<unsigned, 4> RegAdded;
// If this node would clobber any "live" register, then it's not ready.
//
// If SU is the currently live definition of the same register that it uses,
// then we are free to schedule it.
for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
I != E; ++I) {
if (I->isAssignedRegDep())
if (I->isAssignedRegDep() && LiveRegDefs[I->getReg()] != SU)
CheckForLiveRegDef(I->getSUnit(), I->getReg(), LiveRegDefs,
RegAdded, LRegs, TRI);
}
@ -703,20 +706,6 @@ DelayForLiveRegsBottomUp(SUnit *SU, SmallVector<unsigned, 4> &LRegs) {
CheckForLiveRegDef(SU, *Reg, LiveRegDefs, RegAdded, LRegs, TRI);
}
// Okay, we now know all of the live registers that are defined by an
// immediate predecessor. It is ok to kill these registers if we are also
// using it.
for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
if (I->isAssignedRegDep() &&
LiveRegCycles[I->getReg()] == I->getSUnit()->getHeight()) {
unsigned Reg = I->getReg();
if (RegAdded.erase(Reg))
LRegs.erase(std::find(LRegs.begin(), LRegs.end(), Reg));
}
}
return !LRegs.empty();
}