Fix an out-of-bounds access in -view-sunit-dags in the case of an

empty ScheduleDAG.

llvm-svn: 50054
This commit is contained in:
Dan Gohman 2008-04-21 20:07:30 +00:00
parent db08f5218e
commit dc90919d2b
1 changed files with 2 additions and 1 deletions

View File

@ -301,7 +301,8 @@ namespace llvm {
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, "");
}
};