X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fifconv.c;h=d56b723c76d29274d1e6bd347778ac40dabcc7ad;hb=8927bacd38e38685d822329d49c16539b9a4e774;hp=78184eece588af3335b57e6b8d6e1ed8e66111d1;hpb=06f74c054de936e40c2b58aedfb361b9f78ff356;p=libfirm diff --git a/ir/opt/ifconv.c b/ir/opt/ifconv.c index 78184eece..d56b723c7 100644 --- a/ir/opt/ifconv.c +++ b/ir/opt/ifconv.c @@ -21,7 +21,6 @@ * @file ir/opt/ifconv.c * @brief If conversion * @author Christoph Mallon - * @version $Id$ */ #include "config.h" @@ -52,7 +51,7 @@ typedef struct walker_env { bool changed; /**< Set if the graph was changed. */ } walker_env; -DEBUG_ONLY(static firm_dbg_module_t *dbg); +DEBUG_ONLY(static firm_dbg_module_t *dbg;) /** * Returns non-zero if a Block can be emptied. @@ -334,7 +333,11 @@ restart: mux_true = get_Phi_pred(p, i); mux_false = get_Phi_pred(p, j); } - if (!env->allow_ifconv(sel, mux_false, mux_true)) { + if (mux_true == mux_false) + continue; + ir_mode *mode = get_irn_mode(mux_true); + if (mode == mode_M + || !env->allow_ifconv(sel, mux_false, mux_true)) { supported = false; break; } @@ -469,6 +472,12 @@ void opt_if_conv(ir_graph *irg) walker_env env; const backend_params *be_params = be_get_backend_param(); + assure_irg_properties(irg, + IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES + | IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE + | IR_GRAPH_PROPERTY_NO_BADS + | IR_GRAPH_PROPERTY_ONE_RETURN); + /* get the parameters */ env.allow_ifconv = be_params->allow_ifconv; env.changed = false; @@ -477,11 +486,6 @@ void opt_if_conv(ir_graph *irg) DB((dbg, LEVEL_1, "Running if-conversion on %+F\n", irg)); - env.changed |= remove_bads(irg); - - normalize_one_return(irg); - remove_critical_cf_edges(irg); - compute_cdep(irg); ir_reserve_resources(irg, IR_RESOURCE_BLOCK_MARK | IR_RESOURCE_PHI_LIST); @@ -494,13 +498,13 @@ void opt_if_conv(ir_graph *irg) if (env.changed) { local_optimize_graph(irg); - - /* graph has changed, invalidate analysis info */ - set_irg_extblk_inconsistent(irg); - set_irg_doms_inconsistent(irg); } free_cdep(irg); + + confirm_irg_properties(irg, + IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES + | IR_GRAPH_PROPERTY_ONE_RETURN); } ir_graph_pass_t *opt_if_conv_pass(const char *name)