[llvm-commits] [llvm] r122211 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 19 16:55:44 PST 2010
Author: lattner
Date: Sun Dec 19 18:55:43 2010
New Revision: 122211
URL: http://llvm.org/viewvc/llvm-project?rev=122211&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=122211&r1=122210&r2=122211&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Sun Dec 19 18:55:43 2010
@@ -283,7 +283,7 @@
Sequence.push_back(SU);
AvailableQueue->ScheduledNode(SU);
-
+
ReleasePredecessors(SU, CurCycle);
// Release all the implicit physical register defs that are live.
@@ -704,6 +704,19 @@
}
+ // 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();
}
More information about the llvm-commits
mailing list