aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-04-17 05:16:07 +0000
committerIan Lance Taylor <iant@google.com>2007-04-17 05:16:07 +0000
commitd5141f02c56f2da3d012f10c6099f9b8b61f9ba7 (patch)
tree0cf93f4213ae1d224aa2bd48a39f53f3538278de
parent143892ce0558a9edb78131abb21649aa5a9bae38 (diff)
* tree-ssa-propagate.c (cfg_blocks_add): Insert blocks with fewer
predecessors at head rather than tail. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@123906 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-propagate.c22
2 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8575622bd87..a9f1ca548d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-16 Ian Lance Taylor <iant@google.com>
+
+ * tree-ssa-propagate.c (cfg_blocks_add): Insert blocks with fewer
+ predecessors at head rather than tail.
+
2007-04-16 Matthias Klose <doko@debian.org>
* gcc/config/alpha/linux.h (CPP_SPEC): Define.
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 1981fa1783b..df31e25f8ff 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1,5 +1,5 @@
/* Generic SSA value propagation engine.
- Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@@ -176,6 +176,8 @@ cfg_blocks_empty_p (void)
static void
cfg_blocks_add (basic_block bb)
{
+ bool head = false;
+
gcc_assert (bb != ENTRY_BLOCK_PTR && bb != EXIT_BLOCK_PTR);
gcc_assert (!TEST_BIT (bb_in_list, bb->index));
@@ -198,12 +200,26 @@ cfg_blocks_add (basic_block bb)
cfg_blocks_head = 0;
VEC_safe_grow (basic_block, heap, cfg_blocks, 2 * cfg_blocks_tail);
}
- else
+ /* Minor optimization: we prefer to see blocks with more
+ predecessors later, because there is more of a chance that
+ the incoming edges will be executable. */
+ else if (EDGE_COUNT (bb->preds)
+ >= EDGE_COUNT (VEC_index (basic_block, cfg_blocks,
+ cfg_blocks_head)->preds))
cfg_blocks_tail = ((cfg_blocks_tail + 1)
% VEC_length (basic_block, cfg_blocks));
+ else
+ {
+ if (cfg_blocks_head == 0)
+ cfg_blocks_head = VEC_length (basic_block, cfg_blocks);
+ --cfg_blocks_head;
+ head = true;
+ }
}
- VEC_replace (basic_block, cfg_blocks, cfg_blocks_tail, bb);
+ VEC_replace (basic_block, cfg_blocks,
+ head ? cfg_blocks_head : cfg_blocks_tail,
+ bb);
SET_BIT (bb_in_list, bb->index);
}