summaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 9601691f9f9..825b8715da3 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -2080,13 +2080,20 @@ reload (first, global, dumpfile)
{
rtx addr = 0;
int in_struct = 0;
- if (reg_equiv_mem[i])
+ int is_readonly = 0;
+
+ if (reg_equiv_memory_loc[i])
{
- addr = XEXP (reg_equiv_mem[i], 0);
- in_struct = MEM_IN_STRUCT_P (reg_equiv_mem[i]);
+ in_struct = MEM_IN_STRUCT_P (reg_equiv_memory_loc[i]);
+ is_readonly = RTX_UNCHANGING_P (reg_equiv_memory_loc[i]);
}
+
+ if (reg_equiv_mem[i])
+ addr = XEXP (reg_equiv_mem[i], 0);
+
if (reg_equiv_address[i])
addr = reg_equiv_address[i];
+
if (addr)
{
if (reg_renumber[i] < 0)
@@ -2094,6 +2101,7 @@ reload (first, global, dumpfile)
rtx reg = regno_reg_rtx[i];
XEXP (reg, 0) = addr;
REG_USERVAR_P (reg) = 0;
+ RTX_UNCHANGING_P (reg) = is_readonly;
MEM_IN_STRUCT_P (reg) = in_struct;
/* We have no alias information about this newly created
MEM. */
@@ -2565,7 +2573,14 @@ alter_reg (i, from_reg)
{
x = gen_rtx_MEM (GET_MODE (regno_reg_rtx[i]),
plus_constant (XEXP (x, 0), adjust));
- RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[i]);
+
+ /* If this was shared among registers, must ensure we never
+ set it readonly since that can cause scheduling
+ problems. Note we would only have in this adjustment
+ case in any event, since the code above doesn't set it. */
+
+ if (from_reg == -1)
+ RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[i]);
}
/* Save the stack slot for later. */