From 0ff22b7c3f979e511d2d9e24f9d09d3e50482709 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Fri, 29 Apr 2011 12:52:53 +0200 Subject: [PATCH] Improve and correct fp-vrp transformation. - Set modified flag when unreachble nodes are removed. - Remove trivially unreachble blocks, which have no bitinfo. - Consider that unreachble blockes are replaced by Bad before the nodes they contain. --- ir/opt/fp-vrp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ir/opt/fp-vrp.c b/ir/opt/fp-vrp.c index 5e0f1d771..11a169edc 100644 --- a/ir/opt/fp-vrp.c +++ b/ir/opt/fp-vrp.c @@ -586,19 +586,26 @@ static void first_round(ir_node* const irn, void* const env) static void apply_result(ir_node* const irn, void* ctx) { environment_t* env = (environment_t*)ctx; + ir_node* block; bitinfo* b; ir_tarval* z; ir_tarval* o; - ir_node* const block = is_Block(irn) ? irn : get_nodes_block(irn); - if (is_Bad(block)) { - exchange(irn, block); + if (is_Block(irn)) { + bitinfo* const block_b = get_bitinfo(irn); + /* Trivially unreachable blocks have no info. */ + if (block_b == NULL || block_b->z == get_tarval_b_false()) { + exchange(irn, get_irg_bad(get_Block_irg(irn))); + env->modified = 1; + } return; } - bitinfo* const block_b = get_bitinfo(block); - if (block_b && block_b->z == block_b->o && block_b->z == get_tarval_b_false()) { - exchange(irn, get_irg_bad(get_Block_irg(block))); + /* Unreachable blocks are replaced before the nodes in them. */ + block = get_nodes_block(irn); + if (is_Bad(block)) { + exchange(irn, block); + env->modified = 1; return; } -- 2.20.1