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-ssa-dom.c: Speed up tree_ssa_dominator_optimize.


Hi,

Attached is a patch to speed up tree_ssa_dominator_optimize.

tree_ssa_dominator_optimize unconditionally calls free_dominance_info
even when there is no change to CFG.

The patch eliminates calls to free_dominance_info when there is no CFG
change.  Since cleanup_tree_cfg makes some efforts to update dominance
info, chances are we still have up-to-date dominance info even after
cleanup_tree_cfg, allowing calculate_dominance_info to return
immediately.

Here is a timing in seconds for five runs of ./cc1 -quiet -O2
-fomit-frame-pointer -o /dev/null.

               original patched   diff%
c-common.i       13.785  13.761 -0.174%
combine.i        16.651  16.622 -0.174%
fold-const.i     17.076  17.037 -0.228%
reload1.i        11.850  11.809 -0.345%
reload.i         11.754  11.698 -0.476%
insn-attrtab.i  201.720 201.072 -0.321%

FDI              138216  117856 -14.730%

FDI indicates the number of times free_dominance_info really frees
dominance info while compiling cc1-i files.

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

Kazu Hirata

2005-03-02  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
	free_dominance_info only when needed.

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.95
diff -u -d -p -r2.95 tree-ssa-dom.c
--- tree-ssa-dom.c	26 Feb 2005 07:55:28 -0000	2.95
+++ tree-ssa-dom.c	1 Mar 2005 18:51:08 -0000
@@ -444,7 +444,8 @@ tree_ssa_dominator_optimize (void)
 	  bitmap_zero (need_eh_cleanup);
 	}
 
-      free_dominance_info (CDI_DOMINATORS);
+      if (cfg_altered)
+	free_dominance_info (CDI_DOMINATORS);
       cfg_altered = cleanup_tree_cfg ();
       calculate_dominance_info (CDI_DOMINATORS);
 


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