mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
Check aliases for liveness when removing dead vars.
The live var flow analysis doesn't check for aliases. Rather than changing it to check for aliases (which might break uninitialized var analysis, as it uses "use" from the live var analysis), make dag_remove_dead_vars do the check. Fixes the misplaced text in the menus.
This commit is contained in:
parent
95c249e8b9
commit
028b19888f
1 changed files with 12 additions and 0 deletions
|
@ -388,6 +388,15 @@ dagnode_attach_label (dagnode_t *n, daglabel_t *l)
|
||||||
set_add (n->identifiers, l->number);
|
set_add (n->identifiers, l->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
dag_alias_live (def_t *def, void *_live_vars)
|
||||||
|
{
|
||||||
|
set_t *live_vars = (set_t *) _live_vars;
|
||||||
|
if (!def->flowvar)
|
||||||
|
return 0;
|
||||||
|
return set_is_member (live_vars, def->flowvar->number);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dag_remove_dead_vars (dag_t *dag, set_t *live_vars)
|
dag_remove_dead_vars (dag_t *dag, set_t *live_vars)
|
||||||
{
|
{
|
||||||
|
@ -406,6 +415,9 @@ dag_remove_dead_vars (dag_t *dag, set_t *live_vars)
|
||||||
continue;
|
continue;
|
||||||
if (set_is_member (dag->flownode->global_vars, var->number))
|
if (set_is_member (dag->flownode->global_vars, var->number))
|
||||||
continue;
|
continue;
|
||||||
|
if (l->op->op_type == op_def
|
||||||
|
&& def_visit_all (l->op->o.def, 1, dag_alias_live, live_vars))
|
||||||
|
continue;
|
||||||
if (!set_is_member (live_vars, var->number))
|
if (!set_is_member (live_vars, var->number))
|
||||||
set_remove (l->dagnode->identifiers, l->number);
|
set_remove (l->dagnode->identifiers, l->number);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue