Fix a few cases where the scheduler is not checking for phys reg copies. The scheduli...
authorAndrew Trick <atrick@apple.com>
Fri, 24 Dec 2010 06:46:50 +0000 (06:46 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 24 Dec 2010 06:46:50 +0000 (06:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122544 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/ScheduleDAG.cpp
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

index 02e398f7efc834ba688ff5c96f46006c266a7bbf..83f2dd07f1d76eee953a7630f0f97a29aa5e0215 100644 (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());
 }
 
index c93ef4dd46721d4aef8d07be83f2e6115e78981d..d6368047bcd1966d33a982d8acdfb4a5b71d69e4 100644 (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) {