OSDN Git Service

* tree-ssa-dom.c (dom_opt_finalize_block): Fix conditions to
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Oct 2005 16:05:37 +0000 (16:05 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Oct 2005 16:05:37 +0000 (16:05 +0000)
determine whether or not to try and thread outgoing edges.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105091 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-dom.c

index 249eb21..e3d619f 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-07  Jeff Law  <law@redhat.com>
+
+       * 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  <edelsohn@gnu.org>
 
        * config/rs6000/rs6000.md (eqsi_power): New.
index 71dcd4f..b37df77 100644 (file)
@@ -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;