aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-constraints.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2014-06-16 21:39:42 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2014-06-16 21:39:42 +0000
commitba38538fd68b2542277ea236a06b9f418e6d77bd (patch)
tree3301e0b3e18a3af128c45ede67e7edc48c2a4ef4 /gcc/lra-constraints.c
parent7049aed6c84ea55355f2173cb74d5717abadf1b2 (diff)
downloadgcc-ba38538fd68b2542277ea236a06b9f418e6d77bd.zip
gcc-ba38538fd68b2542277ea236a06b9f418e6d77bd.tar.gz
gcc-ba38538fd68b2542277ea236a06b9f418e6d77bd.tar.bz2
re PR rtl-optimization/61325 (aarch64_be build fails)
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
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r--gcc/lra-constraints.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index ab8fe34..b1904e1 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -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;