X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fldstopt.c;h=782598fbf62e27ad2facaae89216d323b3e95432;hb=ea1d901f18ed7573b4664804ae8b5950fb679e19;hp=3e2a01eb825b5242123e4befa99fe71003ae8ae1;hpb=1bf42cbd7bdfda062c04b534fcd796d70e2e993f;p=libfirm diff --git a/ir/opt/ldstopt.c b/ir/opt/ldstopt.c index 3e2a01eb8..782598fbf 100644 --- a/ir/opt/ldstopt.c +++ b/ir/opt/ldstopt.c @@ -723,19 +723,20 @@ static void handle_load_update(ir_node *load) */ static void reduce_adr_usage(ir_node *ptr) { - if (is_Proj(ptr)) { - if (get_irn_n_edges(ptr) <= 0) { - /* this Proj is dead now */ - ir_node *pred = get_Proj_pred(ptr); + ir_node *pred; + if (!is_Proj(ptr)) + return; + if (get_irn_n_edges(ptr) > 0) + return; - if (is_Load(pred)) { - ldst_info_t *info = get_irn_link(pred); - info->projs[get_Proj_proj(ptr)] = NULL; + /* this Proj is dead now */ + pred = get_Proj_pred(ptr); + if (is_Load(pred)) { + ldst_info_t *info = get_irn_link(pred); + info->projs[get_Proj_proj(ptr)] = NULL; - /* this node lost its result proj, handle that */ - handle_load_update(pred); - } - } + /* this node lost its result proj, handle that */ + handle_load_update(pred); } } /* reduce_adr_usage */ @@ -1110,8 +1111,9 @@ static unsigned optimize_load(ir_node *load) /* The mem of the Load. Must still be returned after optimization. */ mem = get_Load_mem(load); - if (! info->projs[pn_Load_res] && ! info->projs[pn_Load_X_except]) { - /* a Load which value is neither used nor exception checked, remove it */ + if (info->projs[pn_Load_res] == NULL + && info->projs[pn_Load_X_except] == NULL) { + /* the value is never used and we don't care about exceptions, remove */ exchange(info->projs[pn_Load_M], mem); if (info->projs[pn_Load_X_regular]) { @@ -1880,7 +1882,7 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env) /* only Phis and pure Calls are allowed here, so ignore them */ } if (other == NULL) { - ldst_info_t *ninfo; + ldst_info_t *ninfo = NULL; phi_entry *pe; dbg_info *db; @@ -2229,13 +2231,13 @@ static int optimize_loops(ir_graph *irg) env.nextDFSnum = 0; env.POnum = 0; env.changes = 0; - phase_init(&env.ph, "ldstopt", irg, PHASE_DEFAULT_GROWTH, init_loop_data, NULL); + phase_init(&env.ph, irg, init_loop_data); /* calculate the SCC's and drive loop optimization. */ do_dfs(irg, &env); DEL_ARR_F(env.stack); - phase_free(&env.ph); + phase_deinit(&env.ph); return env.changes; } /* optimize_loops */