This is the mail archive of the gcc@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]

tree-ssa performance from rebuild_jump_labels's view


Hi,

People often talk about what rtl optimizers we can remove/simplify
once we have tree-level SSA optimizers in place.  So I felt like a
quick benchmark and embedded a few printf's in passes.c to see
how many times we call rebuild_jump_labels() after cse, cse2, gcse,
and combine, and compiled common code, which is actually GCC from last
December or so.

     mainline
-------------------
       calls total
cse1    1187  6318
cse2     197  6318
gcse    4666  6318
bypass   929  6318
combine   13  6318

     tree-ssa
-------------------
       calls total
cse1     214  6344
cse2      21  6344
gcse    4695  6344
bypass   434  6344
combine    7  6344

"calls" is the number of calls to rebuild_jump_labels() right after
CSE1 (or CSE2, GCSE, or COMBINE).

"total" is the number of calls to the CSE1 itself (or CSE2, GCSE, or
COMBINE).

The results on cse1 and cse2 are impressive.  I don't think we can
completely eliminate these, but we might want to know where the
majority is coming from at least.

GCSE, would somebody like to comment?

We have a few calls in the combiner.  This probably means that a
target with a lot of complicated insns can win because the combiner
can use those insns as an intermediate insn to turn conditional jumps
to conditional jumps, etc.  I don't know how tree-ssa can efficiently
eliminate these.  Jeff mentioned tree-combiner, but things may not
combine as well if their results are forced to be gimple.

By the way, why are two totals different?  Because of different
inliners?

Anyway, just a fun with numbers.  For the sake of completeness, I
attached a patch for you.

Kazu Hirata

Index: passes.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/passes.c,v
retrieving revision 2.3
diff -u -r2.3 passes.c
--- passes.c	3 Mar 2004 16:32:38 -0000	2.3
+++ passes.c	15 Mar 2004 05:03:06 -0000
@@ -1008,13 +1008,17 @@
 static void
 rest_of_handle_jump_bypass (tree decl, rtx insns)
 {
+  int tem;
+
   timevar_push (TV_BYPASS);
   open_dump_file (DFI_bypass, decl);
 
   cleanup_cfg (CLEANUP_EXPENSIVE);
   reg_scan (insns, max_reg_num (), 1);
 
-  if (bypass_jumps (dump_file))
+  tem = bypass_jumps (dump_file);
+  fprintf (stderr, "BYPASS %s\n", tem ? "REBUILD_JUMP_LABELS" : "");
+  if (tem)
     {
       rebuild_jump_labels (insns);
       cleanup_cfg (CLEANUP_EXPENSIVE);
@@ -1206,6 +1210,9 @@
   rebuild_jump_labels_after_combine
     = combine_instructions (insns, max_reg_num ());
 
+  fprintf (stderr, "COMBINE %s\n",
+	   rebuild_jump_labels_after_combine ? "REBUILD_JUMP_LABELS" : "");
+
   /* Combining insns may have turned an indirect jump into a
      direct jump.  Rebuild the JUMP_LABEL fields of jumping
      instructions.  */
@@ -1284,6 +1291,7 @@
   reg_scan (insns, max_reg_num (), 1);
 
   tem = cse_main (insns, max_reg_num (), 0, dump_file);
+  fprintf (stderr, "CSE1 %s\n", tem ? "REBUILD_JUMP_LABELS" : "");
   if (tem)
     rebuild_jump_labels (insns);
   if (purge_all_dead_edges (0))
@@ -1327,6 +1335,7 @@
     dump_flow_info (dump_file);
   /* CFG is no longer maintained up-to-date.  */
   tem = cse_main (insns, max_reg_num (), 1, dump_file);
+  fprintf (stderr, "CSE2 %s\n", tem ? "REBUILD_JUMP_LABELS" : "");
 
   /* Run a pass to eliminate duplicated assignments to condition code
      registers.  We have to run this after bypass_jumps, because it
@@ -1361,6 +1370,7 @@
   open_dump_file (DFI_gcse, decl);
 
   tem = gcse_main (insns, dump_file);
+  fprintf (stderr, "GCSE %s\n", tem ? "REBUILD_JUMP_LABELS" : "");
   rebuild_jump_labels (insns);
   delete_trivially_dead_insns (insns, max_reg_num ());
 


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