OSDN Git Service

* cfg.c (redirect_edge_succ_nodup): Use find_edge rather than
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Nov 2004 04:21:49 +0000 (04:21 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Nov 2004 04:21:49 +0000 (04:21 +0000)
        implementing it inline.

        * cfganal.c (find_edge): Search pred->succs or succ->preds,
        whichever is shorter.

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

gcc/ChangeLog
gcc/cfg.c
gcc/cfganal.c

index 20f50a6..6af64c6 100644 (file)
@@ -1,3 +1,11 @@
+2004-11-08 Jeff Law  <law@redhat.com>
+
+       * cfg.c (redirect_edge_succ_nodup): Use find_edge rather than
+       implementing it inline.
+
+       * cfganal.c (find_edge): Search pred->succs or succ->preds,
+       whichever is shorter.
+
 2004-11-08  Kazu Hirata  <kazu@cs.umass.edu>
 
        * passes.c (rest_of_handle_jump): Remove dead code.
 2004-11-08  Kazu Hirata  <kazu@cs.umass.edu>
 
        * passes.c (rest_of_handle_jump): Remove dead code.
index 1901a59..b3da142 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -428,14 +428,9 @@ edge
 redirect_edge_succ_nodup (edge e, basic_block new_succ)
 {
   edge s;
 redirect_edge_succ_nodup (edge e, basic_block new_succ)
 {
   edge s;
-  edge_iterator ei;
-
-  /* Check whether the edge is already present.  */
-  FOR_EACH_EDGE (s, ei, e->src->succs)
-    if (s->dest == new_succ && s != e)
-      break;
 
 
-  if (s)
+  s = find_edge (e->src, new_succ);
+  if (s && s != e)
     {
       s->flags |= e->flags;
       s->probability += e->probability;
     {
       s->flags |= e->flags;
       s->probability += e->probability;
index 651f153..06c71f6 100644 (file)
@@ -478,9 +478,18 @@ find_edge (basic_block pred, basic_block succ)
   edge e;
   edge_iterator ei;
 
   edge e;
   edge_iterator ei;
 
-  FOR_EACH_EDGE (e, ei, pred->succs)
-    if (e->dest == succ)
-      return e;
+  if (EDGE_COUNT (pred->succs) <= EDGE_COUNT (succ->preds))
+    {
+      FOR_EACH_EDGE (e, ei, pred->succs)
+       if (e->dest == succ)
+         return e;
+    }
+  else
+    {
+      FOR_EACH_EDGE (e, ei, succ->preds)
+       if (e->src == pred)
+         return e;
+    }
 
   return NULL;
 }
 
   return NULL;
 }