nv50/ir: Allow attaching two nodes when either one is already inside the graph.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 15 Nov 2011 20:39:52 +0000 (21:39 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 14 Apr 2012 19:54:00 +0000 (21:54 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir_graph.cpp

index b1287001c37e18ca8a0865e305e94b9c5ab29c39..069dc485b6adf6bddf31ce5da940ac67e4426361 100644 (file)
@@ -116,11 +116,11 @@ void Graph::Node::attach(Node *node, Edge::Type kind)
    ++this->outCount;
    ++node->inCount;
 
-   assert(this->graph);
-   if (!node->graph) {
-      node->graph = this->graph;
-      ++node->graph->size;
-   }
+   assert(graph || node->graph);
+   if (!node->graph)
+      graph->insert(node);
+   if (!graph)
+      node->graph->insert(this);
 
    if (kind == Edge::UNKNOWN)
       graph->classifyEdges();