summaryrefslogtreecommitdiff
path: root/gcc/reload.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-16 10:16:15 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-16 10:16:15 +0000
commit8a72adf497f11f1a7c8c49583699d1339f59b8c7 (patch)
tree24148aafcfc6b92104799dde10993008c3662278 /gcc/reload.c
parenta86a1d8bc148960f6534efd6f4920551ada443b6 (diff)
downloadgcc-8a72adf497f11f1a7c8c49583699d1339f59b8c7.tar.gz
gcc/
PR middle-end/32897 * reload.c (find_reloads): Check that the memory returned by find_reloads_toplev was not the result of forcing a constant to memory. (find_reloads_toplev): Always use simplify_gen_subreg to get the subreg of a constant. If the result is also a constant, but not a legitimate one, force it into the constant pool and reload its address. gcc/testsuite/ * gcc.dg/torture/pr32897.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127536 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload.c')
-rw-r--r--gcc/reload.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/reload.c b/gcc/reload.c
index ae913bf094f..06ce96bfd38 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -2794,7 +2794,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
&& MEM_P (op)
&& REG_P (reg)
&& (GET_MODE_SIZE (GET_MODE (reg))
- >= GET_MODE_SIZE (GET_MODE (op))))
+ >= GET_MODE_SIZE (GET_MODE (op)))
+ && reg_equiv_constant[REGNO (reg)] == 0)
set_unique_reg_note (emit_insn_before (gen_rtx_USE (VOIDmode, reg),
insn),
REG_EQUAL, reg_equiv_memory_loc[REGNO (reg)]);
@@ -4600,14 +4601,6 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type,
int regno = REGNO (SUBREG_REG (x));
rtx tem;
- if (subreg_lowpart_p (x)
- && regno >= FIRST_PSEUDO_REGISTER
- && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0
- && (tem = gen_lowpart_common (GET_MODE (x),
- reg_equiv_constant[regno])) != 0)
- return tem;
-
if (regno >= FIRST_PSEUDO_REGISTER
&& reg_renumber[regno] < 0
&& reg_equiv_constant[regno] != 0)
@@ -4616,6 +4609,15 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type,
simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno],
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
gcc_assert (tem);
+ if (CONSTANT_P (tem) && !LEGITIMATE_CONSTANT_P (tem))
+ {
+ tem = force_const_mem (GET_MODE (x), tem);
+ i = find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
+ &XEXP (tem, 0), opnum, type,
+ ind_levels, insn);
+ if (address_reloaded)
+ *address_reloaded = i;
+ }
return tem;
}