From: Jeff Law Date: Tue, 18 Apr 2017 15:00:43 +0000 (-0600) Subject: regcprop.c (maybe_mode_change): Avoid creating copies of the stack pointer. X-Git-Tag: upstream/12.2.0~40203 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1446456c3fcaa7be628726c9de4a877729490ca;p=platform%2Fupstream%2Fgcc.git 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 * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1ff6684..8da35cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2017-04-18 Jeff Law + + * regcprop.c (maybe_mode_change): Avoid creating copies of the + stack pointer. + + Revert: + 2017-04-13 Jeff Law + * 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. + 2017-04-18 Georg-Johann Lay PR target/79453 diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index dd5e1e7..7acf00d 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -3493,10 +3493,7 @@ (define_insn_and_split "*zero_extendsidi2" [(set (match_operand:DI 0 "register_operand" "=d,d") (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,W")))] - "TARGET_64BIT && !ISA_HAS_EXT_INS - && !(TARGET_MIPS16 - && MEM_P (operands[1]) - && reg_mentioned_p (stack_pointer_rtx, operands[1]))" + "TARGET_64BIT && !ISA_HAS_EXT_INS" "@ # lwu\t%0,%1" @@ -3512,10 +3509,7 @@ (define_insn "*zero_extendsidi2_dext" [(set (match_operand:DI 0 "register_operand" "=d,d") (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,W")))] - "TARGET_64BIT && ISA_HAS_EXT_INS - && !(TARGET_MIPS16 - && MEM_P (operands[1]) - && reg_mentioned_p (stack_pointer_rtx, operands[1]))" + "TARGET_64BIT && ISA_HAS_EXT_INS" "@ dext\t%0,%1,0,32 lwu\t%0,%1" diff --git a/gcc/regcprop.c b/gcc/regcprop.c index ddc6252..367d85a 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))