mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-30 08:00:51 +00:00
Remove dead variables after creating the dag.
Not adding them while creating the dag completely broke the dag as node(deadvar) always returned null. Code quality is back to where it was before the dags rewrite.
This commit is contained in:
parent
deb5484c7e
commit
dcc786b16f
1 changed files with 13 additions and 3 deletions
|
@ -332,10 +332,8 @@ dag_create (const flownode_t *flownode)
|
||||||
}
|
}
|
||||||
lx = operand_label (dag, operands[0]);
|
lx = operand_label (dag, operands[0]);
|
||||||
if (lx) {
|
if (lx) {
|
||||||
flowvar_t *var = flow_get_var (lx->op);
|
|
||||||
lx->expr = s->expr;
|
lx->expr = s->expr;
|
||||||
if (set_is_member (flownode->live_vars.out, var->number))
|
dagnode_attach_label (n, lx);
|
||||||
dagnode_attach_label (n, lx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nodes = malloc (dag->num_nodes * sizeof (dagnode_t *));
|
nodes = malloc (dag->num_nodes * sizeof (dagnode_t *));
|
||||||
|
@ -349,6 +347,18 @@ dag_create (const flownode_t *flownode)
|
||||||
if (set_is_empty (dag->nodes[i]->parents))
|
if (set_is_empty (dag->nodes[i]->parents))
|
||||||
set_add (dag->roots, dag->nodes[i]->number);
|
set_add (dag->roots, dag->nodes[i]->number);
|
||||||
}
|
}
|
||||||
|
for (i = 0; i < dag->num_labels; i++) {
|
||||||
|
daglabel_t *l = dag->labels[i];
|
||||||
|
flowvar_t *var;
|
||||||
|
|
||||||
|
if (!l->op || !l->dagnode)
|
||||||
|
continue;
|
||||||
|
var = flow_get_var (l->op);
|
||||||
|
if (!var)
|
||||||
|
continue;
|
||||||
|
if (!set_is_member (flownode->live_vars.out, var->number))
|
||||||
|
set_remove (l->dagnode->identifiers, l->number);
|
||||||
|
}
|
||||||
return dag;
|
return dag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue