X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Freassoc.c;h=4367d210d8370a39b5fa3a41dfb6db94bb4d96a0;hb=4d7f507c357a0bdb1433ef3973645ece971e3824;hp=be6230c52a82c6ccf4bd553dd2d728ee59e30410;hpb=c0da9e550b467a372fe0733724784b0f323c33f5;p=libfirm diff --git a/ir/opt/reassoc.c b/ir/opt/reassoc.c index be6230c52..4367d210d 100644 --- a/ir/opt/reassoc.c +++ b/ir/opt/reassoc.c @@ -597,14 +597,6 @@ static void wq_walker(ir_node *n, void *env) set_irn_link(n, NULL); if (!is_Block(n)) { - ir_node *blk = get_nodes_block(n); - - if (is_Block_dead(blk) || get_Block_dom_depth(blk) < 0) { - /* We are in a dead block, do not optimize or we may fall into an endless - loop. We check this here instead of requiring that all dead blocks are removed - which or cf_opt do not guarantee yet. */ - return; - } waitq_put(wenv->wq, n); set_irn_link(n, wenv->wq); } @@ -616,21 +608,12 @@ static void wq_walker(ir_node *n, void *env) static void do_reassociation(walker_t *wenv) { int i, res, changed; - ir_node *n, *blk; + ir_node *n; while (! waitq_empty(wenv->wq)) { n = (ir_node*)waitq_get(wenv->wq); set_irn_link(n, NULL); - blk = get_nodes_block(n); - if (is_Block_dead(blk) || get_Block_dom_depth(blk) < 0) { - /* We are in a dead block, do not optimize or we may fall into an endless - loop. We check this here instead of requiring that all dead blocks are removed - which or cf_opt do not guarantee yet. */ - continue; - } - - hook_reassociate(1); /* reassociation must run until a fixpoint is reached. */ @@ -942,7 +925,6 @@ static void reverse_rules(ir_node *node, void *env) int optimize_reassociation(ir_graph *irg) { walker_t env; - irg_loopinfo_state state; assert(get_irg_phase_state(irg) != phase_building); assert(get_irg_pinned(irg) != op_pin_state_floats && @@ -958,14 +940,9 @@ int optimize_reassociation(ir_graph *irg) /* * Calculate loop info, so we could identify loop-invariant - * code and threat it like a constant. - * We only need control flow loops here but can handle generic - * INTRA info as well. + * code and treat it like a constant. */ - state = get_irg_loopinfo_state(irg); - if ((state & loopinfo_inter) || - (state & (loopinfo_constructed | loopinfo_valid)) != (loopinfo_constructed | loopinfo_valid)) - construct_cf_backedges(irg); + assure_loopinfo(irg); env.changes = 0; env.irg = irg; @@ -983,12 +960,6 @@ int optimize_reassociation(ir_graph *irg) } set_reassoc_running(0); - /* Handle graph state */ - if (env.changes) { - set_irg_outs_inconsistent(irg); - set_irg_loopinfo_inconsistent(irg); - } - #ifdef NEW_REASSOC obstack_free(&commutative_args, NULL); #endif @@ -1017,7 +988,7 @@ ir_op_ops *firm_set_default_reassoc(unsigned code, ir_op_ops *ops) CASE(Eor); CASE(Shl); default: - /* leave NULL */; + break; } return ops;