This is the mail archive of the gcc-patches@gcc.gnu.org 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 7


Hi,

Attached is a patch to speed up thread_jumps.

One of the things we do not do in thread_jumps is to thread jumps from
ENTRY_BLOCK_PTR, and thread_jumps indeed has code to avoid putting
ENTRY_BLOCK_PTR into worklist.

It turns out we can remove the check for ENTRY_BLOCK_PTR if we pretend
to have ENTRY_BLOCK_PTR in worklist by putting BB_VISITED flag on
ENTRY_BLOCK_PTR.  This is because BB_VISITED is used to avoid putting
duplicates into worklist.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-10-23  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c (thread_jumps): Speed up by pretending to have
	ENTRY_BLOCK_PTR in worklist.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.88
diff -u -p -r2.88 tree-cfg.c
--- tree-cfg.c	22 Oct 2004 17:59:50 -0000	2.88
+++ tree-cfg.c	22 Oct 2004 20:27:02 -0000
@@ -3950,6 +3950,10 @@ thread_jumps (void)
       bb->flags &= ~BB_VISITED;
     }
 
+  /* We pretend to have ENTRY_BLOCK_PTR in WORKLIST.  This way,
+     ENTRY_BLOCK_PTR will never be entered into WORKLIST.  */
+  ENTRY_BLOCK_PTR->flags |= BB_VISITED;
+
   /* Initialize WORKLIST by putting non-forwarder blocks that
      immediately precede forwarder blocks because those are the ones
      that we know we can thread jumps from.  We use BB_VISITED to
@@ -3974,8 +3978,6 @@ thread_jumps (void)
 	  /* We are not interested in threading jumps from a forwarder
 	     block.  */
 	  if (!bb_ann (e->src)->forwardable
-	      /* We don't want to visit ENTRY_BLOCK_PTR.  */
-	      && e->src->index >= 0
 	      /* We don't want to put a duplicate into WORKLIST.  */
 	      && (e->src->flags & BB_VISITED) == 0)
 	    {
@@ -4015,8 +4017,6 @@ thread_jumps (void)
 		  /* We are not interested in threading jumps from a
 		     forwarder block.  */
 		  if (!bb_ann (f->src)->forwardable
-		      /* We don't want to visit ENTRY_BLOCK_PTR.  */
-		      && f->src->index >= 0
 		      /* We don't want to put a duplicate into WORKLIST.  */
 		      && (f->src->flags & BB_VISITED) == 0)
 		    {
@@ -4029,6 +4029,8 @@ thread_jumps (void)
 	}
     }
 
+  ENTRY_BLOCK_PTR->flags &= ~BB_VISITED;
+
   free (worklist);
 
   return retval;


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