aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-10-22 17:56:04 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-10-22 17:56:04 +0000
commitafc3f3960382425780dd949a987d2f2e6fda1878 (patch)
tree009386467711149205f3079bc64d2d94a0aca3bc /gcc
parent7651d1b89e1de5698f746df76be8ba7a3cdfb702 (diff)
downloadgcc-afc3f3960382425780dd949a987d2f2e6fda1878.zip
gcc-afc3f3960382425780dd949a987d2f2e6fda1878.tar.gz
gcc-afc3f3960382425780dd949a987d2f2e6fda1878.tar.bz2
tree-cfg.c (thread_jumps): Speed up by putting basic blocks into worklist instead of their indexes.
* tree-cfg.c (thread_jumps): Speed up by putting basic blocks into worklist instead of their indexes. From-SVN: r89461
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-cfg.c25
2 files changed, 14 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0c5445f..7a23a2d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2004-10-22 Kazu Hirata <kazu@cs.umass.edu>
+ * tree-cfg.c (thread_jumps): Speed up by putting basic blocks
+ into worklist instead of their indexes.
+
+2004-10-22 Kazu Hirata <kazu@cs.umass.edu>
+
* alias.c, basic-block.h, cgraphunit.c, combine.c, domwalk.h,
final.c, gengtype.c, genpreds.c, ggc-page.c, insn-notes.def,
lambda-code.c, loop-unroll.c, modulo-sched.c, pointer-set.c,
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index d58bb13..0bf7b16 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3942,7 +3942,7 @@ thread_jumps (void)
{
basic_block bb;
bool retval = false;
- int *worklist = xmalloc (sizeof (int) * last_basic_block);
+ basic_block *worklist = xmalloc (sizeof (basic_block) * last_basic_block);
unsigned int size = 0;
FOR_EACH_BB (bb)
@@ -3951,11 +3951,11 @@ thread_jumps (void)
bb->flags &= ~BB_VISITED;
}
- /* Initialize WORKLIST by putting the indexes of non-forwarder
- blocks that immediately precede forwarder blocks because those
- are the ones that we know we can thread jumps from. We use
- BB_VISITED to indicate that whether a given basic block is in
- WORKLIST or not, thereby avoiding duplicates in WORKLIST. */
+ /* Initialize WORKLIST by putting non-forwarder blocks that
+ immediately precede forwarder blocks because those are the ones
+ that we know we can thread jumps from. We use BB_VISITED to
+ indicate whether a given basic block is in WORKLIST or not,
+ thereby avoiding duplicates in WORKLIST. */
FOR_EACH_BB (bb)
{
edge_iterator ei;
@@ -3981,7 +3981,7 @@ thread_jumps (void)
&& (e->src->flags & BB_VISITED) == 0)
{
e->src->flags |= BB_VISITED;
- worklist[size] = e->src->index;
+ worklist[size] = e->src;
size++;
}
}
@@ -3991,14 +3991,7 @@ thread_jumps (void)
while (size > 0)
{
size--;
- bb = BASIC_BLOCK (worklist[size]);
-
- /* Check if BB is NULL because BB may have been deleted. This
- could happen if BB is originally a non-forwarder block, later
- becomes a forwarder block, and it is deleted when a jump is
- threaded through it. */
- if (!bb)
- continue;
+ bb = worklist[size];
/* BB->INDEX is not longer in WORKLIST, so clear BB_VISITED. */
bb->flags &= ~BB_VISITED;
@@ -4029,7 +4022,7 @@ thread_jumps (void)
&& (f->src->flags & BB_VISITED) == 0)
{
f->src->flags |= BB_VISITED;
- worklist[size] = f->src->index;
+ worklist[size] = f->src;
size++;
}
}