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


Hi,

Attached is a patch to speed up tree_can_merge_blocks_p by reordering
two checks.

In real-world programs, there are a lot more basic blocks with
multiple predecessors than the exit block.

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

Kazu Hirata

2005-01-11  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c (tree_can_merge_blocks_p): Reorder two checks.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.137
diff -u -d -p -r2.137 tree-cfg.c
--- tree-cfg.c	1 Jan 2005 16:15:10 -0000	2.137
+++ tree-cfg.c	11 Jan 2005 05:32:59 -0000
@@ -1217,12 +1217,12 @@ tree_can_merge_blocks_p (basic_block a, 
   if (EDGE_SUCC (a, 0)->dest != b)
     return false;
 
-  if (b == EXIT_BLOCK_PTR)
-    return false;
-  
   if (EDGE_COUNT (b->preds) > 1)
     return false;
 
+  if (b == EXIT_BLOCK_PTR)
+    return false;
+  
   /* If A ends by a statement causing exceptions or something similar, we
      cannot merge the blocks.  */
   stmt = last_stmt (a);


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