Commit b879b3a8 authored by Christopher Frieler's avatar Christopher Frieler Committed by Matthias Braun
Browse files

respect dependency edges in dead code elimination

parent 2c7e6014
......@@ -180,6 +180,7 @@ void irn_rewire_inputs(ir_node *node)
{
ir_node *new_node;
int arity;
int n_deps;
int i;
new_node = get_new_node(node);
......@@ -197,6 +198,13 @@ void irn_rewire_inputs(ir_node *node)
set_irn_n(new_node, i, new_in);
}
n_deps = get_irn_deps(new_node);
for (i = 0; i < n_deps; ++i) {
ir_node *dep = get_irn_dep(node, i);
ir_node *new_dep = get_new_node(dep);
set_irn_dep(new_node, i, new_dep);
}
/* Now the new node is complete. We can add it to the hash table for CSE. */
add_identities(new_node);
}
......
......@@ -75,13 +75,14 @@ static void copy_node_dce(ir_node *node, void *env)
*/
static void copy_graph_env(ir_graph *irg)
{
ir_node *anchor = irg->anchor;
ir_node *new_anchor;
/* copy nodes */
irg_walk_anchors(irg, copy_node_dce, rewire_inputs, NULL);
irg_walk_in_or_dep(anchor, copy_node_dce, rewire_inputs, NULL);
/* fix the anchor */
new_anchor = (ir_node*)get_irn_link(irg->anchor);
new_anchor = (ir_node*)get_irn_link(anchor);
assert(new_anchor != NULL);
irg->anchor = new_anchor;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment