X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fopt%2Fgvn_pre.c;h=bd2c6606534c6b561a7c35fdcf5a26ba1f0208f5;hb=44faeb9742640d3498eb4482f98eb1255607c4d6;hp=02040aeacb4c03e63307a7c62621e01ec8259da9;hpb=9d3990d89280ebcb8a996a52bbddcb307e785da5;p=libfirm diff --git a/ir/opt/gvn_pre.c b/ir/opt/gvn_pre.c index 02040aeac..bd2c66065 100644 --- a/ir/opt/gvn_pre.c +++ b/ir/opt/gvn_pre.c @@ -77,6 +77,7 @@ typedef struct pre_env { ir_node *end_block; /**< The end block of the current graph */ block_info *list; /**< Links all block info entires for easier recovery. */ elim_pair *pairs; /**< A list of node pairs that must be eliminated. */ + unsigned last_idx; /**< last node index of "old" nodes, all higher indexes are newly created once. */ char changes; /**< Non-zero, if calculation of Antic_in has changed. */ char first_iter; /**< non-zero for first iteration */ } pre_env; @@ -719,7 +720,7 @@ static void eliminate(ir_node *irn, void *ctx) { p->old_node = irn; p->new_node = expr; p->next = env->pairs; - p->reason = FS_OPT_GVN_FULLY; + p->reason = get_irn_idx(expr) >= env->last_idx ? FS_OPT_GVN_PARTLY : FS_OPT_GVN_FULLY; env->pairs = p; } } @@ -823,6 +824,7 @@ void do_gvn_pre(ir_graph *irg) irg_walk_blkwise_graph(irg, NULL, topo_walker, &a_env); /* clean the exp_gen set. Doing this here saves the cleanup in the iteration. */ + inc_irg_visited(irg); for (bl_info = a_env.list; bl_info != NULL; bl_info = bl_info->next) { ir_valueset_iterator_t iter; @@ -851,6 +853,7 @@ void do_gvn_pre(ir_graph *irg) /* compute redundant expressions */ insert_iter = 0; + a_env.last_idx = get_irg_last_idx(irg); do { DB((dbg, LEVEL_1, "Insert Iteration %d starts ...\n", ++insert_iter)); a_env.changes = 0;