From: Jeff Law Date: Fri, 7 Oct 2005 16:05:37 +0000 (-0600) Subject: tree-ssa-dom.c (dom_opt_finalize_block): Fix conditions to determine whether or not... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e352c00e15e9742aa076287839f40813957ce21;p=gcc.git tree-ssa-dom.c (dom_opt_finalize_block): Fix conditions to determine whether or not to try and thread outgoing edges. * tree-ssa-dom.c (dom_opt_finalize_block): Fix conditions to determine whether or not to try and thread outgoing edges. From-SVN: r105091 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 249eb2153f6..e3d619f7f04 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-10-07 Jeff Law + + * tree-ssa-dom.c (dom_opt_finalize_block): Fix conditions to + determine whether or not to try and thread outgoing edges. + 2005-10-07 David Edelsohn * config/rs6000/rs6000.md (eqsi_power): New. diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 71dcd4ffc6d..b37df7797f8 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1020,14 +1020,14 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb) { tree last; - /* If we are at a leaf node in the dominator tree, see if we can thread - the edge from BB through its successor. - - Do this before we remove entries from our equivalence tables. */ + /* If we have an outgoing edge to a block with multiple incoming and + outgoing edges, then we may be able to thread the edge. ie, we + may be able to statically determine which of the outgoing edges + will be traversed when the incoming edge from BB is traversed. */ if (single_succ_p (bb) && (single_succ_edge (bb)->flags & EDGE_ABNORMAL) == 0 - && (get_immediate_dominator (CDI_DOMINATORS, single_succ (bb)) != bb - || phi_nodes (single_succ (bb)))) + && !single_pred_p (single_succ (bb)) + && !single_succ_p (single_succ (bb))) { thread_across_edge (walk_data, single_succ_edge (bb)); @@ -1044,10 +1044,9 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb) extract_true_false_edges_from_block (bb, &true_edge, &false_edge); - /* If the THEN arm is the end of a dominator tree or has PHI nodes, - then try to thread through its edge. */ - if (get_immediate_dominator (CDI_DOMINATORS, true_edge->dest) != bb - || phi_nodes (true_edge->dest)) + /* Only try to thread the edge if it reaches a target block with + more than one predecessor and more than one successor. */ + if (!single_pred_p (true_edge->dest) && !single_succ_p (true_edge->dest)) { struct edge_info *edge_info; unsigned int i; @@ -1094,8 +1093,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb) } /* Similarly for the ELSE arm. */ - if (get_immediate_dominator (CDI_DOMINATORS, false_edge->dest) != bb - || phi_nodes (false_edge->dest)) + if (!single_pred_p (false_edge->dest) && !single_succ_p (false_edge->dest)) { struct edge_info *edge_info; unsigned int i;