Cleanup of the [SU]ADDO type legalization code. Patch by Duncan!
[oota-llvm.git] / include / llvm / CodeGen / DAGISelHeader.h
index 3b4da6618e7dc8794aab8b4dbef1901f3d1a9642..28b227772a51f0eed8c0400d3baec2b13be122d7 100644 (file)
@@ -108,6 +108,11 @@ void SelectRoot(SelectionDAG &DAG) {
   // node).
   while (ISelPosition != CurDAG->allnodes_begin()) {
     SDNode *Node = --ISelPosition;
+    // Skip dead nodes. DAGCombiner is expected to eliminate all dead nodes,
+    // but there are currently some corner cases that it misses. Also, this
+    // makes it theoretically possible to disable the DAGCombiner.
+    if (Node->use_empty())
+      continue;
 #if 0
     DAG.setSubgraphColor(Node, "red");
 #endif