Patchwork [lra] patch to fix some testsuite regressions on ppc

login
register
mail settings
Submitter Vladimir Makarov
Date June 8, 2012, 10:35 p.m.
Message ID <4FD27E4E.1010901@redhat.com>
Download mbox | patch
Permalink /patch/163870/
State New
Headers show

Comments

Vladimir Makarov - June 8, 2012, 10:35 p.m.
The following patch fixing some LRA crashes (when I tried a new 
heuristics in insn alternative selection) on GCC tests on ppc.

The patch was successfully bootstrapped on x86-64 and power7.

Committed as rev. 188350.

2012-06-08  Vladimir Makarov <vmakarov@redhat.com>

         * emit-rtl.c (validate_subreg): Don't check offset for LRA and
         floating point modes.

         * lra.c (lra): Call lra_hard_reg_substitution after resetting
         lra_in_progress.

         * lra-constraints.c (match_reload): Unshare new regs.

Patch

Index: lra.c
===================================================================
--- lra.c	(revision 188341)
+++ lra.c	(working copy)
@@ -2217,8 +2217,8 @@  lra (FILE *f)
     }
   restore_scratches ();
   lra_eliminate (true);
-  lra_hard_reg_substitution ();
   lra_in_progress = 0;
+  lra_hard_reg_substitution ();
   lra_clear_live_ranges ();
   lra_live_ranges_finish ();
   lra_contraints_finish ();
Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 188341)
+++ lra-constraints.c	(working copy)
@@ -872,9 +872,9 @@  match_reload (signed char out, signed ch
 	    = lra_create_new_reg_with_unique_value (outmode, out_rtx,
 						    goal_class, "");
 	  if (SCALAR_INT_MODE_P (outmode))
-	    new_in_reg = gen_lowpart_SUBREG (inmode, new_out_reg);
+	    new_in_reg = gen_lowpart_SUBREG (inmode, reg);
 	  else
-	    new_in_reg = gen_rtx_SUBREG (inmode, new_out_reg, 0);
+	    new_in_reg = gen_rtx_SUBREG (inmode, reg, 0);
 	}
       bitmap_set_bit (&lra_matched_pseudos, REGNO (reg));
       bitmap_set_bit (&lra_bound_pseudos, REGNO (reg));
@@ -903,7 +903,7 @@  match_reload (signed char out, signed ch
   narrow_reload_pseudo_class (in_rtx, goal_class);
   narrow_reload_pseudo_class (out_rtx, goal_class);
   push_to_sequence (*before);
-  lra_emit_move (new_in_reg, in_rtx);
+  lra_emit_move (copy_rtx (new_in_reg), in_rtx);
   *before = get_insns ();
   end_sequence ();
   for (i = 0; (in = ins[i]) >= 0; i++)
@@ -912,7 +912,7 @@  match_reload (signed char out, signed ch
   if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX)
     {
       start_sequence ();
-      lra_emit_move (out_rtx, new_out_reg);
+      lra_emit_move (out_rtx, copy_rtx (new_out_reg));
       emit_insn (*after);
       *after = get_insns ();
       end_sequence ();
Index: emit-rtl.c
===================================================================
--- emit-rtl.c	(revision 188333)
+++ emit-rtl.c	(working copy)
@@ -760,7 +760,8 @@  validate_subreg (enum machine_mode omode
      of a subword.  A subreg does *not* perform arbitrary bit extraction.
      Given that we've already checked mode/offset alignment, we only have
      to check subword subregs here.  */
-  if (osize < UNITS_PER_WORD)
+  if (osize < UNITS_PER_WORD
+      && ! (lra_in_progress && (FLOAT_MODE_P (imode) || FLOAT_MODE_P (omode))))
     {
       enum machine_mode wmode = isize > UNITS_PER_WORD ? word_mode : imode;
       unsigned int low_off = subreg_lowpart_offset (omode, wmode);