This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] tree-cfg.c: Speed up thread_jumps () - Part 2
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 04 Oct 2004 12:59:24 -0400 (EDT)
- Subject: [patch] tree-cfg.c: Speed up thread_jumps () - Part 2
Hi,
Attached is a patch to speed up thread_jumps().
When we thread a jump, it is important to notice an infinite loop so
that we won't end up following forwarder blocks forever.
thread_jumps() in tree.cfg.c precisely checks for that case, except
that it does so twice in a row for nothing.
Consider the "for" loop shown in the patch. When we get into the
loop, we have
tree_forwarder_block_p (dest) == true
meaning that
bb_ann (dest)->forwardable == 1
implying that the "if" statment
if (!bb_ann (dest)->forwardable)
break;
will never trigger.
The patch removes the "if" statement that never triggers.
Tested on i686-pc-linux-gnu on top of
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00169.html
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00186.html
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00279.html
OK to apply?
Kazu Hirata
2004-10-04 Kazu Hirata <kazu@cs.umass.edu>
* tree-cfg.c (thread_jumps): Remove a duplicate check for
an infinite loop.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.64
diff -U5 -r2.64 tree-cfg.c
--- tree-cfg.c 2 Oct 2004 12:47:10 -0000 2.64
+++ tree-cfg.c 3 Oct 2004 15:50:31 -0000
@@ -3893,15 +3893,10 @@
for (dest = EDGE_SUCC (e->dest, 0)->dest;
tree_forwarder_block_p (dest);
last = EDGE_SUCC (dest, 0),
dest = EDGE_SUCC (dest, 0)->dest)
{
- /* An infinite loop detected. We redirect the edge anyway, so
- that the loop is shrunk into single basic block. */
- if (!bb_ann (dest)->forwardable)
- break;
-
if (EDGE_SUCC (dest, 0)->dest == EXIT_BLOCK_PTR)
break;
bb_ann (dest)->forwardable = 0;
}