X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firgmod.c;h=7d55d7a325b59e04004cf4e62eee53d735a384b7;hb=0952881a2714f8ec2e87a6f4829bd55f41a0c68d;hp=47abfa32c45b1500a125b09b06fadd68d871cbb4;hpb=27da8abc4d6e8e2171e8317636694a036ee114b3;p=libfirm diff --git a/ir/ir/irgmod.c b/ir/ir/irgmod.c index 47abfa32c..7d55d7a32 100644 --- a/ir/ir/irgmod.c +++ b/ir/ir/irgmod.c @@ -40,7 +40,7 @@ turn_into_tuple (ir_node *node, int arity) } else { /* Allocate new array, don't free old in_array, it's on the obstack. */ ir_node *block = get_nodes_block(node); - edges_invalidate(node, current_ir_graph); + edges_node_deleted(node, current_ir_graph); node->in = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity+1); /* clear the new in array, else edge_notify tries to delete garbage */ memset(node->in, 0, (arity+1) * sizeof(node->in[0])); @@ -54,6 +54,7 @@ turn_into_tuple (ir_node *node, int arity) void exchange (ir_node *old, ir_node *nw) { + assert(old != nw && "Exchanging node with itself is not allowed"); hook_replace(old, nw); /* @@ -61,7 +62,11 @@ exchange (ir_node *old, ir_node *nw) * the edges from the old node to the new directly. */ if (edges_activated(current_ir_graph)) { + /* copy all dependencies from old to new */ + add_irn_deps(nw, old); + edges_reroute(old, nw, current_ir_graph); + edges_reroute_kind(old, nw, EDGE_KIND_DEP, current_ir_graph); edges_node_deleted(old, current_ir_graph); old->op = op_Bad; }