summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beverify.c
diff options
context:
space:
mode:
authorSebastian Buchwald <Sebastian.Buchwald@kit.edu>2015-12-02 15:54:56 +0100
committerSebastian Buchwald <Sebastian.Buchwald@kit.edu>2015-12-02 15:54:56 +0100
commitf1d435c6ec90a7f8ce0bdc5f9bc09c34d36bfcd6 (patch)
tree42a07be4c5b05f192c3fbb3e932085220bf26ed2 /ir/be/beverify.c
parentcb236975b4851cf1e58d5e60e799f390ef8d8888 (diff)
Simplify liveness validation.
This also fixes a possible null pointer access.
Diffstat (limited to 'ir/be/beverify.c')
-rw-r--r--ir/be/beverify.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/ir/be/beverify.c b/ir/be/beverify.c
index 571b713..39ce23a 100644
--- a/ir/be/beverify.c
+++ b/ir/be/beverify.c
@@ -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));
}
}
}