Fix a few cases where the scheduler is not checking for phys reg copies. The scheduling node may have a NULL DAG node, yuck.

llvm-svn: 122544
This commit is contained in:
Andrew Trick 2010-12-24 06:46:50 +00:00
parent 9d6af5328e
commit c94056692a
2 changed files with 11 additions and 4 deletions

View File

@ -36,7 +36,7 @@ ScheduleDAG::~ScheduleDAG() {}
/// getInstrDesc helper to handle SDNodes.
const TargetInstrDesc *ScheduleDAG::getNodeDesc(const SDNode *Node) const {
if (!Node->isMachineOpcode()) return NULL;
if (!Node || !Node->isMachineOpcode()) return NULL;
return &TII->get(Node->getMachineOpcode());
}

View File

@ -435,6 +435,13 @@ void ScheduleDAGRRList::AdvancePastStalls(SUnit *SU) {
/// Record this SUnit in the HazardRecognizer.
/// Does not update CurCycle.
void ScheduleDAGRRList::EmitNode(SUnit *SU) {
if (!EnableSchedCycles || HazardRec->getMaxLookAhead() == 0)
return;
// Check for phys reg copy.
if (!SU->getNode())
return;
switch (SU->getNode()->getOpcode()) {
default:
assert(SU->getNode()->isMachineOpcode() &&
@ -645,13 +652,13 @@ static bool isOperandOf(const SUnit *SU, SDNode *N) {
/// CopyAndMoveSuccessors - Clone the specified node and move its scheduled
/// successors to the newly created node.
SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
if (SU->getNode()->getGluedNode())
return NULL;
SDNode *N = SU->getNode();
if (!N)
return NULL;
if (SU->getNode()->getGluedNode())
return NULL;
SUnit *NewSU;
bool TryUnfold = false;
for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {