Patchwork [lra] patch to fix several testsuite failures

login
register
mail settings
Submitter Vladimir Makarov
Date Oct. 23, 2012, 2:42 a.m.
Message ID <5086042E.2050308@redhat.com>
Download mbox | patch
Permalink /patch/193320/
State New
Headers show

Comments

Vladimir Makarov - Oct. 23, 2012, 2:42 a.m.
The following patch fixes several new testsuite failures.

   Committed as rev. 192657.

2012-10-22  Vladimir Makarov  <vmakarov@redhat.com>

     * inherit_reload_reg (inherit_reload_reg): Print bb numbers too.
     (need_for_split_p): Don't split eliminable registers.
     (fix_bb_live_info): Don't use EXECUTE_IF_AND_IN_BITMAP.

Patch

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 192689)
+++ lra-constraints.c	(working copy)
@@ -3939,8 +3939,8 @@  inherit_reload_reg (bool def_p, int orig
     /* We now have a new usage insn for original regno.  */
     setup_next_usage_insn (original_regno, new_insns, reloads_num, false);
   if (lra_dump_file != NULL)
-    fprintf (lra_dump_file, "	 Original reg change %d->%d:\n",
-	     original_regno, REGNO (new_reg));
+    fprintf (lra_dump_file, "	 Original reg change %d->%d (bb%d):\n",
+	     original_regno, REGNO (new_reg), BLOCK_FOR_INSN (insn)->index);
   lra_reg_info[REGNO (new_reg)].restore_regno = original_regno;
   bitmap_set_bit (&check_only_regs, REGNO (new_reg));
   bitmap_set_bit (&check_only_regs, original_regno);
@@ -3969,8 +3969,10 @@  inherit_reload_reg (bool def_p, int orig
       lra_update_insn_regno_info (usage_insn);
       if (lra_dump_file != NULL)
 	{
-	  fprintf (lra_dump_file, "    Inheritance reuse change %d->%d:\n",
-		   original_regno, REGNO (new_reg));
+	  fprintf (lra_dump_file,
+		   "    Inheritance reuse change %d->%d (bb%d):\n",
+		   original_regno, REGNO (new_reg),
+		   BLOCK_FOR_INSN (usage_insn)->index);
 	  debug_rtl_slim (lra_dump_file, usage_insn, usage_insn,
 			  -1, 0);
 	}
@@ -4015,6 +4017,13 @@  need_for_split_p (HARD_REG_SET potential
 
   lra_assert (hard_regno >= 0);
   return ((TEST_HARD_REG_BIT (potential_reload_hard_regs, hard_regno)
+	   /* Don't split eliminable hard registers, otherwise we can
+	      split hard registers like hard frame pointer, which
+	      lives on BB start/end according to DF-infrastructure,
+	      when there is a pseudo assigned to the register and
+	      living in the same BB.  */
+	   && (regno >= FIRST_PSEUDO_REGISTER
+	       || ! TEST_HARD_REG_BIT (eliminable_regset, hard_regno))
 	   && ! TEST_HARD_REG_BIT (lra_no_alloc_regs, hard_regno)
 	   /* We need at least 2 reloads to make pseudo splitting
 	      profitable.  We should provide hard regno splitting in
@@ -4284,7 +4293,7 @@  update_ebb_live_info (rtx head, rtx tail
   edge e;
   edge_iterator ei;
 
-  last_bb = BLOCK_FOR_INSN (tail);
+  last_bb = BLOCK_FOR_INSN (tail); 
   prev_bb = NULL;
   for (curr_insn = tail;
        curr_insn != PREV_INSN (head);
@@ -4492,7 +4501,7 @@  inherit_in_ebb (rtx head, rtx tail)
 	  after_p = (! JUMP_P (last_insn)
 		     && (! CALL_P (last_insn)
 			 || (find_reg_note (last_insn,
-					   REG_NORETURN, NULL) == NULL_RTX
+					   REG_NORETURN, NULL_RTX) == NULL_RTX
 			     && ! SIBLING_CALL_P (last_insn))));
 	  REG_SET_TO_HARD_REG_SET (live_hard_regs, df_get_live_out (curr_bb));
 	  IOR_HARD_REG_SET (live_hard_regs, eliminable_regset);
@@ -4800,7 +4809,6 @@  lra_inheritance (void)
   edge e;
 
   timevar_push (TV_LRA_INHERITANCE);
-
   lra_inheritance_iter++;
   if (lra_dump_file != NULL)
     fprintf (lra_dump_file, "\n********** Inheritance #%d: **********\n\n",
@@ -4867,11 +4875,9 @@  fix_bb_live_info (bitmap live, bitmap re
   unsigned int regno;
   bitmap_iterator bi;
 
-  EXECUTE_IF_AND_IN_BITMAP (removed_pseudos, live, 0, regno, bi)
-    {
-      bitmap_clear_bit (live, regno);
+  EXECUTE_IF_SET_IN_BITMAP (removed_pseudos, 0, regno, bi)
+    if (bitmap_clear_bit (live, regno))
       bitmap_set_bit (live, lra_reg_info[regno].restore_regno);
-    }
 }
 
 /* Return regno of the (subreg of) REG. Otherwise, return a negative