diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-20 00:55:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-20 00:55:43 +0000 |
commit | 981afd206bf8e3113099f57ca0ec0da68ff3ce08 (patch) | |
tree | ede3170362054bf601ac9bccad3fc7506d7690bc /llvm/lib/CodeGen/SelectionDAG | |
parent | 075a16b09e141b297fb6b51cf9a7517b596acd8f (diff) | |
download | bcm5719-llvm-981afd206bf8e3113099f57ca0ec0da68ff3ce08.tar.gz bcm5719-llvm-981afd206bf8e3113099f57ca0ec0da68ff3ce08.zip |
Fix a bug in the scheduler's handling of "unspillable" vregs.
Imagine we see:
EFLAGS = inst1
EFLAGS = inst2 FLAGS
gpr = inst3 EFLAGS
Previously, we would refuse to schedule inst2 because it clobbers
the EFLAGS of the predecessor. However, it also uses the EFLAGS
of the predecessor, so it is safe to emit. SDep edges ensure that
the right order happens already anyway.
This fixes 2 testsuite crashes with the X86 patch I'm going to
commit next.
llvm-svn: 122211
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp index 0f4d9c82678..72bfe7195d6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp @@ -283,7 +283,7 @@ void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) { Sequence.push_back(SU); AvailableQueue->ScheduledNode(SU); - + ReleasePredecessors(SU, CurCycle); // Release all the implicit physical register defs that are live. @@ -704,6 +704,19 @@ DelayForLiveRegsBottomUp(SUnit *SU, SmallVector<unsigned, 4> &LRegs) { } + // 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(); } |