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 tree_redirect_edge_and_branch.


Hi,

Attached is a patch to speed up tree_redirect_edge_and_branch.

The result of find_edge is needed only in the "then" arm of the "if"
statement shown in the patch.

The patch simply moves the call to find_edge to the "then" arm.

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

Kazu Hirata

2004-11-29  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c (tree_redirect_edge_and_branch): Call find_edge
	only when needed.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.125
diff -u -d -p -r2.125 tree-cfg.c
--- tree-cfg.c	27 Nov 2004 17:26:15 -0000	2.125
+++ tree-cfg.c	27 Nov 2004 21:32:03 -0000
@@ -4315,12 +4315,12 @@ tree_redirect_edge_and_branch (edge e, b
     case SWITCH_EXPR:
       {
         tree cases = get_cases_for_edge (e, stmt);
-	edge e2 = find_edge (e->src, dest);
 
 	/* If we have a list of cases associated with E, then use it
 	   as it's a lot faster than walking the entire case vector.  */
 	if (cases)
 	  {
+	    edge e2 = find_edge (e->src, dest);
 	    tree last, first;
 
 	    first = cases;


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