This is the mail archive of the
mailing list for the GCC project.
[patch] tree-cfg.c: Speed up tree_forwarder_block_p.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Nov 2004 16:38:31 -0500 (EST)
- Subject: [patch] tree-cfg.c: Speed up tree_forwarder_block_p.
Attached is a patch to speed up tree_forwarder_block_p by reordering
The "for" loop immediately below the "if" statement that I am moving
in the patch catches far more non-forwarder blocks than the "if"
statement for an obvious reason. There are far more basic blocks with
at least one statement than basic blocks that are successors of
Here is a timing in seconds for three runs of "./cc1 -quiet -O2
-fomit-frame-pointer -o /dev/null insn-attrtab.i".
real: 135.841 134.997 (0.621% down)
user: 133.496 132.616 (0.659% down)
Tested on i686-pc-linux-gnu. OK to apply?
2004-11-23 Kazu Hirata <email@example.com>
* tree-cfg.c (tree_forwarder_block_p): Speed up by reordering
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.118
diff -u -d -p -r2.118 tree-cfg.c
--- tree-cfg.c 23 Nov 2004 19:34:35 -0000 2.118
+++ tree-cfg.c 23 Nov 2004 20:09:00 -0000
@@ -3907,9 +3907,6 @@ tree_forwarder_block_p (basic_block bb)
gcc_assert (bb != ENTRY_BLOCK_PTR);
- if (find_edge (ENTRY_BLOCK_PTR, bb))
- 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))
@@ -3928,6 +3925,9 @@ tree_forwarder_block_p (basic_block bb)
+ if (find_edge (ENTRY_BLOCK_PTR, bb))
+ return false;