summaryrefslogtreecommitdiff
path: root/gcc/regcprop.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2017-04-18 09:00:43 -0600
committerJeff Law <law@gcc.gnu.org>2017-04-18 09:00:43 -0600
commitd1446456c3fcaa7be628726c9de4a877729490ca (patch)
treebf42d7f94795c94d38ce7af3875c9809475a0fa8 /gcc/regcprop.c
parent8c468e1dcd29c3ca6d0ee2d9099c22b10e24e0ac (diff)
regcprop.c (maybe_mode_change): Avoid creating copies of the stack pointer.
* regcprop.c (maybe_mode_change): Avoid creating copies of the stack pointer. Revert: 2017-04-13 Jeff Law <law@redhat.com> * config/mips.mips.md (zero_extendsidi2): Do not allow SP to appear in operands[1] if it is a MEM and TARGET_MIPS16 is active. From-SVN: r246970
Diffstat (limited to 'gcc/regcprop.c')
-rw-r--r--gcc/regcprop.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index ddc6252f53a..367d85a7e24 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -396,6 +396,13 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode,
&& GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
return NULL_RTX;
+ /* Avoid creating multiple copies of the stack pointer. Some ports
+ assume there is one and only one stack pointer.
+
+ It's unclear if we need to do the same for other special registers. */
+ if (regno == STACK_POINTER_REGNUM)
+ return NULL_RTX;
+
if (orig_mode == new_mode)
return gen_raw_REG (new_mode, regno);
else if (mode_change_ok (orig_mode, new_mode, regno))