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]

[ira] patch for propagation save/restore info through loops


Hi, writing comments about save/restore placement optimization I
found that I miss propagation of save/restore info through loops for
registers which are not mentioned in loops, although I wrote about it
in comments inc caller-save.c.

The following patch solves the problem.  It generates a bit better
(e.g. SPEC2000 gcc perofrmance was improved about 0.7%) and smaller
code.

The patch was boostrapped on x86/x86_64 and ppc64.

2008-06-11 Vladimir Makarov <vmakarov@redhat.com>

   * caller-save.c (restore_con_fun_n, save_con_fun_n): Use loop
   mentioned_regs instead of clearing all result.

Index: caller-save.c
===================================================================
--- caller-save.c	(revision 136681)
+++ caller-save.c	(working copy)
@@ -1211,13 +1211,11 @@ restore_con_fun_n (edge e)
   if (bb_info->empty_restore_in_p)
     return;
 
-  if (bb->loop_depth > pred->loop_depth)
-    {
-      CLEAR_HARD_REG_SET (bb_info->restore_in);
-      return;
-    }
   COPY_HARD_REG_SET (temp_set, BB_INFO (pred)->restore_out);
   AND_COMPL_HARD_REG_SET (temp_set, BB_INFO (pred)->restore_here);
+  if (bb->loop_depth > pred->loop_depth)
+    AND_COMPL_HARD_REG_SET (temp_set,
+			    LOOP_INFO (bb->loop_father)->mentioned_regs);
   AND_HARD_REG_SET (temp_set, bb_info->live_at_start);
   if (EDGE_PRED (bb, 0) == e)
     COPY_HARD_REG_SET (bb_info->restore_in, temp_set);
@@ -1369,13 +1367,11 @@ save_con_fun_n (edge e)
   if (bb_info->empty_save_out_p)
     return;
 
-  if (bb->loop_depth > succ->loop_depth)
-    {
-      CLEAR_HARD_REG_SET (bb_info->save_out);
-      return;
-    }
   COPY_HARD_REG_SET (temp_set, BB_INFO (succ)->save_in);
   AND_COMPL_HARD_REG_SET (temp_set, BB_INFO (succ)->save_here);
+  if (bb->loop_depth > succ->loop_depth)
+    AND_COMPL_HARD_REG_SET (temp_set,
+			    LOOP_INFO (bb->loop_father)->mentioned_regs);
   AND_HARD_REG_SET (temp_set, bb_info->live_at_end);
   if (EDGE_SUCC (bb, 0) == e)
     COPY_HARD_REG_SET (bb_info->save_out, temp_set);

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