[llvm-commits] [llvm] r50054 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

Dan Gohman gohman at apple.com
Mon Apr 21 13:07:31 PDT 2008


Author: djg
Date: Mon Apr 21 15:07:30 2008
New Revision: 50054

URL: http://llvm.org/viewvc/llvm-project?rev=50054&view=rev
Log:
Fix an out-of-bounds access in -view-sunit-dags in the case of an
empty ScheduleDAG.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=50054&r1=50053&r2=50054&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Apr 21 15:07:30 2008
@@ -301,7 +301,8 @@
     static void addCustomGraphFeatures(ScheduleDAG *G,
                                        GraphWriter<ScheduleDAG*> &GW) {
       GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot");
-      if (G->DAG.getRoot().Val)
+      if (G->DAG.getRoot().Val &&
+          G->SUnitMap.find(G->DAG.getRoot().Val) != G->SUnitMap.end())
         GW.emitEdge(0, -1, G->SUnitMap[G->DAG.getRoot().Val].front(), -1, "");
     }
   };





More information about the llvm-commits mailing list