aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgloopmanip.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-12-08 18:52:48 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-12-08 18:52:48 +0000
commitb057216dba84bd26eeb749d876fde5b871e01e15 (patch)
tree4e16e8f3757b241aca3fb4449f18006ee08624a5 /gcc/cfgloopmanip.c
parentd63a0e228c533fe4ab3b78007d43b3c6bf6a83d1 (diff)
downloadgcc-b057216dba84bd26eeb749d876fde5b871e01e15.zip
gcc-b057216dba84bd26eeb749d876fde5b871e01e15.tar.gz
gcc-b057216dba84bd26eeb749d876fde5b871e01e15.tar.bz2
cfgloopmanip.c (create_preheader): Speed up by "unrolling" and simplifying FOR_EACH_EDGE.
* cfgloopmanip.c (create_preheader): Speed up by "unrolling" and simplifying FOR_EACH_EDGE. From-SVN: r91913
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r--gcc/cfgloopmanip.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 06fbf70..77988c2 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -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;