aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-11-08 22:41:40 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-11-08 22:41:40 +0000
commit31864f59563cedc3311da0139a0e1be069ed8de9 (patch)
treeec56bc6d355d6883616455c1023dc6a3fce63600 /gcc
parent892c7e1ec64650c6759c5f7f33f980ff8df9f464 (diff)
downloadgcc-31864f59563cedc3311da0139a0e1be069ed8de9.zip
gcc-31864f59563cedc3311da0139a0e1be069ed8de9.tar.gz
gcc-31864f59563cedc3311da0139a0e1be069ed8de9.tar.bz2
tree-cfg.c (thread_jumps): Speed up by keeping a pointer to the last used element in the worklist.
* tree-cfg.c (thread_jumps): Speed up by keeping a pointer to the last used element in the worklist. From-SVN: r90314
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-cfg.c13
2 files changed, 10 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ed764d2..c373c83 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2004-11-08 Kazu Hirata <kazu@cs.umass.edu>
+ * tree-cfg.c (thread_jumps): Speed up by keeping a pointer to
+ the last used element in the worklist.
+
+2004-11-08 Kazu Hirata <kazu@cs.umass.edu>
+
* tree-inline.c (remap_save_expr): Make it static.
* tree-inline.h: Remove the corresponding prototype.
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 0e6b55d..8dfaffb 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3934,7 +3934,7 @@ thread_jumps (void)
basic_block bb;
bool retval = false;
basic_block *worklist = xmalloc (sizeof (basic_block) * last_basic_block);
- unsigned int size = 0;
+ basic_block *current = worklist;
FOR_EACH_BB (bb)
{
@@ -3974,17 +3974,15 @@ thread_jumps (void)
&& !bb_ann (e->src)->forwardable)
{
e->src->flags |= BB_VISITED;
- worklist[size] = e->src;
- size++;
+ *current++ = e->src;
}
}
}
/* Now let's drain WORKLIST. */
- while (size > 0)
+ while (worklist != current)
{
- size--;
- bb = worklist[size];
+ bb = *--current;
/* BB is no longer in WORKLIST, so clear BB_VISITED. */
bb->flags &= ~BB_VISITED;
@@ -4013,8 +4011,7 @@ thread_jumps (void)
&& !bb_ann (f->src)->forwardable)
{
f->src->flags |= BB_VISITED;
- worklist[size] = f->src;
- size++;
+ *current++ = f->src;
}
}
}