This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] tree-cfg.c: Speed up thread_jumps () - Part 2


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)

will never trigger.

The patch removes the "if" statement that never triggers.

Tested on i686-pc-linux-gnu on top of

OK to apply?

Kazu Hirata

2004-10-04  Kazu Hirata  <>

	* 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)
 	      bb_ann (dest)->forwardable = 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]