aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-10-08 13:20:39 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-10-08 13:20:39 +0000
commit10a5233517ed126df715d041cdb64e41bb365cb2 (patch)
tree92519b84d1073787b2b240233b78ec42b58c986f /gcc
parentc054bc3d7a7758deca716ee59948379bf86b694f (diff)
downloadgcc-10a5233517ed126df715d041cdb64e41bb365cb2.zip
gcc-10a5233517ed126df715d041cdb64e41bb365cb2.tar.gz
gcc-10a5233517ed126df715d041cdb64e41bb365cb2.tar.bz2
tree-cfg.c (tree_forwarder_block_p): Reorder checks so that common cases will be caught earlier than others.
* tree-cfg.c (tree_forwarder_block_p): Reorder checks so that common cases will be caught earlier than others. From-SVN: r88752
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-cfg.c30
2 files changed, 21 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 341b9fe..5bb44a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-08 Kazu Hirata <kazu@cs.umass.edu>
+
+ * tree-cfg.c (tree_forwarder_block_p): Reorder checks so that
+ common cases will be caught earlier than others.
+
2004-10-08 Michael Matz <matz@suse.de>
* loop-doloop.c (doloop_optimize): Extend count.
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 5aaad4a..c1d40d5 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3694,7 +3694,10 @@ tree_make_forwarder_block (edge fallthru)
/* Return true if basic block BB does nothing except pass control
flow to another block and that we can safely insert a label at
- the start of the successor block. */
+ the start of the successor block.
+
+ As a precondition, we require that BB be not equal to
+ ENTRY_BLOCK_PTR. */
static bool
tree_forwarder_block_p (basic_block bb)
@@ -3708,17 +3711,25 @@ tree_forwarder_block_p (basic_block bb)
if (! bb_ann (bb)->forwardable)
return false;
- /* BB must have a single outgoing normal edge. Otherwise it can not be
- a forwarder block. */
+ /* BB must have a single outgoing edge. */
if (EDGE_COUNT (bb->succs) != 1
+ /* BB can not have any PHI nodes. This could potentially be
+ relaxed early in compilation if we re-rewrote the variables
+ appearing in any PHI nodes in forwarder blocks. */
+ || phi_nodes (bb)
+ /* BB may not be a predecessor of EXIT_BLOCK_PTR. */
|| EDGE_SUCC (bb, 0)->dest == EXIT_BLOCK_PTR
- || (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL)
- || bb == ENTRY_BLOCK_PTR)
+ /* BB may not have an abnormal outgoing edge. */
+ || (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL))
{
bb_ann (bb)->forwardable = 0;
return false;
}
+#if ENABLE_CHECKING
+ gcc_assert (bb != ENTRY_BLOCK_PTR);
+#endif
+
/* Successors of the entry block are not forwarders. */
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR->succs)
if (e->dest == bb)
@@ -3727,15 +3738,6 @@ tree_forwarder_block_p (basic_block bb)
return false;
}
- /* BB can not have any PHI nodes. This could potentially be relaxed
- early in compilation if we re-rewrote the variables appearing in
- any PHI nodes in forwarder blocks. */
- if (phi_nodes (bb))
- {
- bb_ann (bb)->forwardable = 0;
- return false;
- }
-
/* Now walk through the statements. We can ignore labels, anything else
means this is not a forwarder block. */
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))