[llvm-commits] [llvm] r122544 - in /llvm/trunk/lib/CodeGen: ScheduleDAG.cpp SelectionDAG/ScheduleDAGRRList.cpp

Andrew Trick atrick at apple.com
Thu Dec 23 22:46:50 PST 2010


Author: atrick
Date: Fri Dec 24 00:46:50 2010
New Revision: 122544

URL: http://llvm.org/viewvc/llvm-project?rev=122544&view=rev
Log:
Fix a few cases where the scheduler is not checking for phys reg copies. The scheduling node may have a NULL DAG node, yuck.

Modified:
    llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

Modified: llvm/trunk/lib/CodeGen/ScheduleDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAG.cpp?rev=122544&r1=122543&r2=122544&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAG.cpp Fri Dec 24 00:46:50 2010
@@ -36,7 +36,7 @@
 
 /// 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());
 }
 

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=122544&r1=122543&r2=122544&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Fri Dec 24 00:46:50 2010
@@ -435,6 +435,13 @@
 /// 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 @@
 /// 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) {





More information about the llvm-commits mailing list