diff options
author | Vladimir Makarov <vmakarov@redhat.com> | 2015-12-04 19:23:21 +0000 |
---|---|---|
committer | Vladimir Makarov <vmakarov@gcc.gnu.org> | 2015-12-04 19:23:21 +0000 |
commit | 18c8f1a812865bbd0f07b29910c54ab8c0632c54 (patch) | |
tree | 9fa2dc2b4803b9e2a57fc353b8d1eeecee987348 /gcc/lra-eliminations.c | |
parent | 4ff3145ae198ae8f4e2c9c60e2df0267ac52329b (diff) | |
download | gcc-18c8f1a812865bbd0f07b29910c54ab8c0632c54.zip gcc-18c8f1a812865bbd0f07b29910c54ab8c0632c54.tar.gz gcc-18c8f1a812865bbd0f07b29910c54ab8c0632c54.tar.bz2 |
re PR rtl-optimization/68349 (ice in decompose_normal_address with -O2 at rtlanal.c:6086)
2015-12-04 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/68349
* lra-eliminations.c (move_plus_up): New function.
(lra_eliminate_regs_1): Use the function.
2015-12-04 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/68349
* gcc.target/i386/pr68349.c: New test.
From-SVN: r231300
Diffstat (limited to 'gcc/lra-eliminations.c')
-rw-r--r-- | gcc/lra-eliminations.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c index 38b1fbb..c639d36 100644 --- a/gcc/lra-eliminations.c +++ b/gcc/lra-eliminations.c @@ -279,6 +279,29 @@ get_elimination (rtx reg) return &self_elim_table; } +/* Transform (subreg (plus reg const)) to (plus (subreg reg) const) + when it is possible. Return X or the transformation result if the + transformation is done. */ +static rtx +move_plus_up (rtx x) +{ + rtx subreg_reg; + enum machine_mode x_mode, subreg_reg_mode; + + if (GET_CODE (x) != SUBREG || !subreg_lowpart_p (x)) + return x; + subreg_reg = SUBREG_REG (x); + x_mode = GET_MODE (x); + subreg_reg_mode = GET_MODE (subreg_reg); + if (GET_CODE (x) == SUBREG && GET_CODE (subreg_reg) == PLUS + && GET_MODE_SIZE (x_mode) <= GET_MODE_SIZE (subreg_reg_mode) + && CONSTANT_P (XEXP (subreg_reg, 1))) + return gen_rtx_PLUS (x_mode, lowpart_subreg (x_mode, subreg_reg, + subreg_reg_mode), + XEXP (subreg_reg, 1)); + return x; +} + /* Scan X and replace any eliminable registers (such as fp) with a replacement (such as sp) if SUBST_P, plus an offset. The offset is a change in the offset between the eliminable register and its @@ -407,6 +430,8 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode, subst_p, update_p, update_sp_offset, full_p); + new0 = move_plus_up (new0); + new1 = move_plus_up (new1); if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1)) return form_sum (new0, new1); } |