cfgloopmanip.c (create_preheader): Speed up by "unrolling" and simplifying FOR_EACH_EDGE.
authorKazu Hirata <kazu@cs.umass.edu>
Wed, 8 Dec 2004 18:52:48 +0000 (18:52 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 8 Dec 2004 18:52:48 +0000 (18:52 +0000)
* cfgloopmanip.c (create_preheader): Speed up by "unrolling"
and simplifying FOR_EACH_EDGE.

From-SVN: r91913

gcc/ChangeLog
gcc/cfgloopmanip.c

index bcdc638984b57e5a4d3a1fb08a52e6950ebced1f..7972254f6ed1697b54678cef5367beb9a312917a 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-08  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * cfgloopmanip.c (create_preheader): Speed up by "unrolling"
+       and simplifying FOR_EACH_EDGE.
+
 2004-12-08  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/frv/frv.c (frv_sort_insn_group): Always initialize
index 06fbf701e23b9184e5e7886216229bacb4821c53..77988c20c2f61c2ce445777cd1dfc08359ad6d99 100644 (file)
@@ -1156,9 +1156,10 @@ create_preheader (struct loop *loop, int flags)
   gcc_assert (nentry);
   if (nentry == 1)
     {
-      FOR_EACH_EDGE (e, ei, loop->header->preds)
-       if (e->src != loop->latch)
-         break;
+      /* Get an edge that is different from the one from loop->latch
+        to loop->header.  */
+      e = EDGE_PRED (loop->header,
+                    EDGE_PRED (loop->header, 0)->src == loop->latch);
 
       if (!(flags & CP_SIMPLE_PREHEADERS) || EDGE_COUNT (e->src->succs) == 1)
        return NULL;
@@ -1178,9 +1179,10 @@ create_preheader (struct loop *loop, int flags)
 
   /* Reorganize blocks so that the preheader is not stuck in the middle of the
      loop.  */
-  FOR_EACH_EDGE (e, ei, dummy->preds)
-    if (e->src != loop->latch)
-      break;
+  
+  /* Get an edge that is different from the one from loop->latch to
+     dummy.  */
+  e = EDGE_PRED (dummy, EDGE_PRED (dummy, 0)->src == loop->latch);
   move_block_after (dummy, e->src);
 
   loop->header->loop_father = loop;