------- Comment #39 from vmakarov at redhat dot com  2009-09-04 16:05 -------
 Uros, Eric, Rainer,  could somebody of you check the following patch works.  I
tried to reproduce the bug on several available to me machines since yesterday
night and I failed.

Index: ira.c
===================================================================
--- ira.c       (revision 151388)
+++ ira.c       (working copy)
@@ -2384,9 +2384,21 @@ update_equiv_regs (void)

          /* We only handle the case of a pseudo register being set
             once, or always to the same value.  */
+         /* ??? The mn10200 port breaks if we add equivalences for
+            values that need an ADDRESS_REGS register and set them equivalent
+            to a MEM of a pseudo.  The actual problem is in the
over-conservative
+            handling of INPADDR_ADDRESS / INPUT_ADDRESS / INPUT triples in
+            calculate_needs, but we traditionally work around this problem
+            here by rejecting equivalences when the destination is in a
register
+            that's likely spilled.  This is fragile, of course, since the
+            preferred class of a pseudo depends on all instructions that set
+            or use it.  */
+
          if (!REG_P (dest)
              || (regno = REGNO (dest)) < FIRST_PSEUDO_REGISTER
-             || reg_equiv[regno].init_insns == const0_rtx)
+             || reg_equiv[regno].init_insns == const0_rtx
+             || (CLASS_LIKELY_SPILLED_P (reg_preferred_class (regno))
+                 && MEM_P (src) && ! reg_equiv[regno].is_arg_equivalence))
            {
              /* This might be setting a SUBREG of a pseudo, a pseudo that is
                 also set somewhere else to a constant.  */
Index: reginfo.c
===================================================================
--- reginfo.c   (revision 151388)
+++ reginfo.c   (working copy)
@@ -952,13 +952,18 @@ allocate_reg_info (void)
 }


-/* Resize reg info. The new elements will be uninitialized.  */
+/* Resize reg info. The new elements will be uninitialized.  Return
+   TRUE if new elements (for new pseudos) were added.  */
 bool
 resize_reg_info (void)
 {
   int old;

-  gcc_assert (reg_pref != NULL);
+  if (reg_pref == NULL)
+    {
+      allocate_reg_info ();
+      return true;
+    }
   if (reg_info_size == max_reg_num ())
     return false;
   old = reg_info_size;
@@ -1000,7 +1005,6 @@ reginfo_init (void)
   /* This prevents dump_flow_info from losing if called
      before reginfo is run.  */
   reg_pref = NULL;
-  allocate_reg_info ();
   /* No more global register variables may be declared.  */
   no_global_reg_vars = 1;
   return 1;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41241

Reply via email to