Commit f1d435c6 authored by yb9976's avatar yb9976
Browse files

Simplify liveness validation.

This also fixes a possible null pointer access.
parent cb236975
......@@ -764,32 +764,24 @@ static const char *lv_flags_to_str(unsigned flags)
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);
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 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);
ir_fprintf(stderr, "current:\n");
for (unsigned i = 0; i < n_curr; ++i) {
be_lv_info_node_t *const n = &curr->nodes[i];
ir_fprintf(stderr, "%+F %u %+F %s\n", bl, i, n->node, lv_flags_to_str(n->flags));
}
} else if (curr) {
unsigned const n_curr = curr->n_members;
unsigned const n_fresh = fr->n_members;
if (n_curr != n_fresh) {
ir_fprintf(stderr, "%+F: liveness set sizes differ. curr %d, correct %d\n", bl, n_curr, n_fresh);
ir_fprintf(stderr, "current:\n");
for (unsigned i = 0; i < n_curr; ++i) {
be_lv_info_node_t *const n = &curr->nodes[i];
ir_fprintf(stderr, "%+F %u %+F %s\n", bl, i, n->node, lv_flags_to_str(n->flags));
}
ir_fprintf(stderr, "correct:\n");
for (unsigned i = 0; i < n_fresh; ++i) {
be_lv_info_node_t *const n = &fr->nodes[i];
ir_fprintf(stderr, "%+F %u %+F %s\n", bl, i, n->node, lv_flags_to_str(n->flags));
}
ir_fprintf(stderr, "correct:\n");
for (unsigned i = 0; i < n_fresh; ++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));
}
}
}
......
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