]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/61325 (aarch64_be build fails)
authorVladimir Makarov <vmakarov@redhat.com>
Mon, 16 Jun 2014 21:39:42 +0000 (21:39 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Mon, 16 Jun 2014 21:39:42 +0000 (21:39 +0000)
2014-06-16  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/61325
* lra-constraints.c (valid_address_p): Add forward declaration.
(simplify_operand_subreg): Check address validity before and after
alter_reg of memory subreg.

From-SVN: r211715

gcc/ChangeLog
gcc/lra-constraints.c

index f6485e16e0b35a73fae4eebefa0e508e45bd8225..dc0926a002818f45700c1a5cbfd8d62eb34f5303 100644 (file)
@@ -1,3 +1,10 @@
+2014-06-16  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/61325
+       * lra-constraints.c (valid_address_p): Add forward declaration.
+       (simplify_operand_subreg): Check address validity before and after
+       alter_reg of memory subreg.
+
 2014-06-16  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.c (decide_alg): Correctly handle
index ab8fe3453c4582949c337550302d508eaaaab48d..b1904e1bf65493fd664736f9edafedecf4073083 100644 (file)
@@ -1333,6 +1333,8 @@ insert_move_for_subreg (rtx *before, rtx *after, rtx origreg, rtx newreg)
     }
 }
 
+static int valid_address_p (enum machine_mode mode, rtx addr, addr_space_t as);
+
 /* Make reloads for subreg in operand NOP with internal subreg mode
    REG_MODE, add new reloads for further processing.  Return true if
    any reload was generated.  */
@@ -1363,10 +1365,26 @@ simplify_operand_subreg (int nop, enum machine_mode reg_mode)
      equivalences in function lra_constraints) and because for spilled
      pseudos we allocate stack memory enough for the biggest
      corresponding paradoxical subreg.  */
-  if ((MEM_P (reg)
-       && (! SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg))
-          || MEM_ALIGN (reg) >= GET_MODE_ALIGNMENT (mode)))
-      || (REG_P (reg) && REGNO (reg) < FIRST_PSEUDO_REGISTER))
+  if (MEM_P (reg)
+      && (! SLOW_UNALIGNED_ACCESS (mode, MEM_ALIGN (reg))
+         || MEM_ALIGN (reg) >= GET_MODE_ALIGNMENT (mode)))
+    {
+      rtx subst, old = *curr_id->operand_loc[nop];
+
+      alter_subreg (curr_id->operand_loc[nop], false);
+      subst = *curr_id->operand_loc[nop];
+      lra_assert (MEM_P (subst));
+      if (! valid_address_p (GET_MODE (reg), XEXP (reg, 0),
+                            MEM_ADDR_SPACE (reg))
+         || valid_address_p (GET_MODE (subst), XEXP (subst, 0),
+                             MEM_ADDR_SPACE (subst)))
+       return true;
+      /* If the address was valid and became invalid, prefer to reload
+        the memory.  Typical case is when the index scale should
+        correspond the memory.  */
+      *curr_id->operand_loc[nop] = old;
+    }
+  else if (REG_P (reg) && REGNO (reg) < FIRST_PSEUDO_REGISTER)
     {
       alter_subreg (curr_id->operand_loc[nop], false);
       return true;