X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree-ssa-dce.c;h=4e3499aa6e11c5b152c4cca9e9317b3b3c814c5f;hb=db35a7f00d5fa55c81e2d0e45fa57524f2b7fb38;hp=bb24b6254d28b18ec6bc930a338591126ad7af39;hpb=be2517f5d18146f44ff3d2912a28b524a99424c4;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index bb24b6254d2..4e3499aa6e1 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -917,27 +917,6 @@ remove_dead_phis (basic_block bb) return something_changed; } -/* Find first live post dominator of BB. */ - -static basic_block -get_live_post_dom (basic_block bb) -{ - basic_block post_dom_bb; - - - /* The post dominance info has to be up-to-date. */ - gcc_assert (dom_info_state (CDI_POST_DOMINATORS) == DOM_OK); - - /* Get the immediate post dominator of bb. */ - post_dom_bb = get_immediate_dominator (CDI_POST_DOMINATORS, bb); - /* And look for first live one. */ - while (post_dom_bb != EXIT_BLOCK_PTR - && !TEST_BIT (bb_contains_live_stmts, post_dom_bb->index)) - post_dom_bb = get_immediate_dominator (CDI_POST_DOMINATORS, post_dom_bb); - - return post_dom_bb; -} - /* Forward edge E to respective POST_DOM_BB and update PHIs. */ static edge @@ -961,10 +940,9 @@ forward_edge_to_pdom (edge e, basic_block post_dom_bb) if (!gimple_seq_empty_p (phi_nodes (post_dom_bb))) { /* We are sure that for every live PHI we are seeing control dependent BB. - This means that we can look up the end of control dependent path leading - to the PHI itself. */ + This means that we can pick any edge to duplicate PHI args from. */ FOR_EACH_EDGE (e2, ei, post_dom_bb->preds) - if (e2 != e && dominated_by_p (CDI_POST_DOMINATORS, e->src, e2->src)) + if (e2 != e) break; for (gsi = gsi_start_phis (post_dom_bb); !gsi_end_p (gsi);) { @@ -972,40 +950,27 @@ forward_edge_to_pdom (edge e, basic_block post_dom_bb) tree op; source_location locus; - /* Dead PHI do not imply control dependency. */ - if (!gimple_plf (phi, STMT_NECESSARY) - && is_gimple_reg (gimple_phi_result (phi))) - { - gsi_next (&gsi); - continue; - } - if (gimple_phi_arg_def (phi, e->dest_idx)) - { - gsi_next (&gsi); - continue; - } - - /* We didn't find edge to update. This can happen for PHIs on virtuals - since there is no control dependency relation on them. We are lost - here and must force renaming of the symbol. */ + /* PHIs for virtuals have no control dependency relation on them. + We are lost here and must force renaming of the symbol. */ if (!is_gimple_reg (gimple_phi_result (phi))) { mark_virtual_phi_result_for_renaming (phi); remove_phi_node (&gsi, true); continue; } - if (!e2) - { - op = gimple_phi_arg_def (phi, e->dest_idx == 0 ? 1 : 0); - locus = gimple_phi_arg_location (phi, e->dest_idx == 0 ? 1 : 0); - } - else + + /* Dead PHI do not imply control dependency. */ + if (!gimple_plf (phi, STMT_NECESSARY)) { - op = gimple_phi_arg_def (phi, e2->dest_idx); - locus = gimple_phi_arg_location (phi, e2->dest_idx); + gsi_next (&gsi); + continue; } + + op = gimple_phi_arg_def (phi, e2->dest_idx); + locus = gimple_phi_arg_location (phi, e2->dest_idx); add_phi_arg (phi, op, e, locus); - gcc_assert (e2 || degenerate_phi_p (phi)); + /* The resulting PHI if not dead can only be degenerate. */ + gcc_assert (degenerate_phi_p (phi)); gsi_next (&gsi); } } @@ -1041,7 +1006,7 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb) edge e, e2; edge_iterator ei; - post_dom_bb = get_live_post_dom (bb); + post_dom_bb = get_immediate_dominator (CDI_POST_DOMINATORS, bb); e = find_edge (bb, post_dom_bb);