X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Ffp-vrp.c;h=1ecafd1f361f32ecc0412d478e76abaeae25adc3;hb=762b472fc81c73cf7a1b0041b8cd286b7206d79d;hp=16eaad2fdb744fb5e58beb13369c104850d3ceb7;hpb=fe7ff338c74dd5d0ebdc2ebc13e905dc40ebfc86;p=libfirm diff --git a/ir/opt/fp-vrp.c b/ir/opt/fp-vrp.c index 16eaad2fd..1ecafd1f3 100644 --- a/ir/opt/fp-vrp.c +++ b/ir/opt/fp-vrp.c @@ -36,9 +36,9 @@ #include "irdom.h" #include "iredges.h" #include "irgmod.h" -#include "irgraph.h" +#include "irgraph_t.h" #include "irgwalk.h" -#include "irnode.h" +#include "irnode_t.h" #include "iroptimize.h" #include "irtools.h" #include "tv.h" @@ -176,6 +176,8 @@ static int transfer(ir_node* const irn) ir_tarval* z; ir_tarval* o; + if (is_Bad(irn)) return 0; + if (m == mode_X) { bitinfo* const b = get_bitinfo(get_nodes_block(irn)); @@ -321,6 +323,11 @@ undefined: /* TODO Use bound and relation. */ z = b->z; o = b->o; + if ((get_Confirm_relation(irn) & ~ir_relation_unordered) == ir_relation_equal) { + bitinfo* const bound_b = get_bitinfo(get_Confirm_bound(irn)); + z = tarval_and(z, bound_b->z); + o = tarval_or( o, bound_b->o); + } break; } @@ -632,6 +639,18 @@ static void first_round(ir_node* const irn, void* const env) } } +static ir_node *make_bad_block(ir_graph *irg) +{ + ir_node *bad = new_r_Bad(irg, mode_BB); + bitinfo *bb = get_bitinfo(bad); + if (bb == NULL) { + ir_tarval* const f = get_tarval_b_false(); + ir_tarval* const t = get_tarval_b_true(); + set_bitinfo(bad, f, t); /* Undefined. */ + } + return bad; +} + static void apply_result(ir_node* const irn, void* ctx) { environment_t* env = (environment_t*)ctx; @@ -645,7 +664,8 @@ static void apply_result(ir_node* const irn, void* ctx) 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))); + ir_node *bad = make_bad_block(get_irn_irg(irn)); + exchange(irn, bad); env->modified = 1; } return; @@ -656,7 +676,10 @@ static void apply_result(ir_node* const irn, void* ctx) /* Trivially unreachable blocks have no info. */ if (block_b == NULL || block_b->z == get_tarval_b_false()) { /* Unreachable blocks might be replaced before the nodes in them. */ - exchange(irn, is_Bad(block) ? block : get_irg_bad(get_Block_irg(block))); + ir_mode *mode = get_irn_mode(irn); + ir_graph *irg = get_irn_irg(irn); + ir_node *bad = new_r_Bad(irg, mode); + exchange(irn, bad); env->modified = 1; return; } @@ -685,7 +708,7 @@ static void apply_result(ir_node* const irn, void* ctx) add_End_keepalive(get_irg_end(irg), block); n = new_r_Jmp(block); } else { - n = new_r_Bad(irg); + n = new_r_Bad(irg, mode_X); /* Transferring analysis information to the bad node makes it a * candidate for replacement. */ goto exchange_only; @@ -810,13 +833,13 @@ void fixpoint_vrp(ir_graph* const irg) { pdeq* const q = new_pdeq(); - /* We need this extra step because the dom tree does not contain unreachable - blocks in Firm. Moreover build phi list. */ + /* We need this extra step because the dom tree does not contain + * unreachable blocks in Firm. Moreover build phi list. */ irg_walk_anchors(irg, clear_links, build_phi_lists, NULL); - { ir_tarval* const f = get_tarval_b_false(); + { + ir_tarval* const f = get_tarval_b_false(); ir_tarval* const t = get_tarval_b_true(); - set_bitinfo(get_irg_bad(irg), f, t); /* Undefined. */ set_bitinfo(get_irg_end_block(irg), t, f); /* Reachable. */ } @@ -839,10 +862,8 @@ void fixpoint_vrp(ir_graph* const irg) if (env.modified) { /* control flow might changed */ - set_irg_outs_inconsistent(irg); set_irg_extblk_inconsistent(irg); set_irg_doms_inconsistent(irg); - set_irg_loopinfo_inconsistent(irg); set_irg_entity_usage_state(irg, ir_entity_usage_not_computed); }