X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Ffp-vrp.c;h=314358f531fb645ddf6939c0c927f4b85f51b97d;hb=b27ae245166bb695bc4e418ff416d91bc37d0f28;hp=14db1fba7c791bcb1b8e0d0a320393eee30a211b;hpb=c5a1cfe5daba4a6ea88e5ed610ab03c896779626;p=libfirm diff --git a/ir/opt/fp-vrp.c b/ir/opt/fp-vrp.c index 14db1fba7..314358f53 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" @@ -275,7 +275,7 @@ result_unknown_X: DB((dbg, LEVEL_3, "transfer %+F\n", irn)); - if (b->z == f) { + if (b == NULL || b->z == f) { undefined: z = get_tarval_null(m); o = get_tarval_all_one(m); @@ -321,6 +321,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 +637,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 +662,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 +674,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 +706,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 +831,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 +860,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); }