Commit f1d435c6 authored by yb9976's avatar yb9976
Browse files

Simplify liveness validation.

This also fixes a possible null pointer access.
parent cb236975
......@@ -766,16 +766,9 @@ static void lv_check_walker(ir_node *bl, void *data)
{
lv_walker_t *const w = (lv_walker_t*)data;
be_lv_info_t *const curr = ir_nodehashmap_get(be_lv_info_t, &w->given->map, bl);
be_lv_info_t *const fr = ir_nodehashmap_get(be_lv_info_t, &w->fresh->map, bl);
if (!fr && curr && curr->n_members > 0) {
ir_fprintf(stderr, "%+F liveness should be empty but current liveness contains:\n", bl);
for (unsigned i = 0; i < curr->n_members; ++i) {
ir_fprintf(stderr, "\t%+F\n", curr->nodes[i].node);
}
} else if (curr) {
unsigned const n_curr = curr->n_members;
unsigned const n_fresh = fr->n_members;
be_lv_info_t *const fresh = ir_nodehashmap_get(be_lv_info_t, &w->fresh->map, bl);
unsigned const n_curr = curr ? curr->n_members : 0;
unsigned const n_fresh = fresh ? fresh->n_members : 0;
if (n_curr != n_fresh) {
ir_fprintf(stderr, "%+F: liveness set sizes differ. curr %d, correct %d\n", bl, n_curr, n_fresh);
......@@ -787,11 +780,10 @@ static void lv_check_walker(ir_node *bl, void *data)
ir_fprintf(stderr, "correct:\n");
for (unsigned i = 0; i < n_fresh; ++i) {
be_lv_info_node_t *const n = &fr->nodes[i];
be_lv_info_node_t *const n = &fresh->nodes[i];
ir_fprintf(stderr, "%+F %u %+F %s\n", bl, i, n->node, lv_flags_to_str(n->flags));
}
}
}
}
void be_liveness_check(be_lv_t *lv)
......
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