aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 4543835..7ba93a6 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3098,7 +3098,12 @@ eliminate_regs_in_insn (rtx insn, int replace)
if (GET_CODE (XEXP (plus_cst_src, 0)) == SUBREG)
to_rtx = gen_lowpart (GET_MODE (XEXP (plus_cst_src, 0)),
to_rtx);
- if (offset == 0)
+ /* If we have a nonzero offset, and the source is already
+ a simple REG, the following transformation would
+ increase the cost of the insn by replacing a simple REG
+ with (plus (reg sp) CST). So try only when we already
+ had a PLUS before. */
+ if (offset == 0 || plus_src)
{
int num_clobbers;
/* We assume here that if we need a PARALLEL with
@@ -3107,7 +3112,7 @@ eliminate_regs_in_insn (rtx insn, int replace)
There's not much we can do if that doesn't work. */
PATTERN (insn) = gen_rtx_SET (VOIDmode,
SET_DEST (old_set),
- to_rtx);
+ plus_constant (to_rtx, offset));
num_clobbers = 0;
INSN_CODE (insn) = recog (PATTERN (insn), insn, &num_clobbers);
if (num_clobbers)
@@ -3120,26 +3125,6 @@ eliminate_regs_in_insn (rtx insn, int replace)
}
gcc_assert (INSN_CODE (insn) >= 0);
}
- /* If we have a nonzero offset, and the source is already
- a simple REG, the following transformation would
- increase the cost of the insn by replacing a simple REG
- with (plus (reg sp) CST). So try only when we already
- had a PLUS before. */
- else if (plus_src)
- {
- new_body = old_body;
- if (! replace)
- {
- new_body = copy_insn (old_body);
- if (REG_NOTES (insn))
- REG_NOTES (insn) = copy_insn_1 (REG_NOTES (insn));
- }
- PATTERN (insn) = new_body;
- old_set = single_set (insn);
-
- XEXP (SET_SRC (old_set), 0) = to_rtx;
- XEXP (SET_SRC (old_set), 1) = GEN_INT (offset);
- }
else
break;