diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-02-16 10:04:00 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-02-16 10:04:00 +0100 |
commit | 33006d53fd3adf2baae85b625e3ec99908b7a31c (patch) | |
tree | d5f0990f699df7b85a6e9cdea483db0c2c48652a /gcc/lra.c | |
parent | c9b34e397c61aa6aec556189bfeac329dee052a6 (diff) | |
download | gcc-33006d53fd3adf2baae85b625e3ec99908b7a31c.zip gcc-33006d53fd3adf2baae85b625e3ec99908b7a31c.tar.gz gcc-33006d53fd3adf2baae85b625e3ec99908b7a31c.tar.bz2 |
re PR rtl-optimization/83723 (ICE: in gen_rtx_SUBREG, at emit-rtl.c:1010)
PR rtl-optimization/83723
* lra-int.h (lra_substitute_pseudo): Add DEBUG_P argument.
* lra.c (lra_substitute_pseudo): Likewise. If true, use
gen_rtx_raw_SUBREG instead of gen_rtx_SUBREG. Pass DEBUG_P to
recursive calls.
(lra_substitute_pseudo_within_insn): Adjust lra_substitute_pseudo
callers.
* lra-constraints.c (inherit_reload_reg, split_reg): Likewise.
* gcc.dg/pr83723.c: New test.
From-SVN: r257725
Diffstat (limited to 'gcc/lra.c')
-rw-r--r-- | gcc/lra.c | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -1893,9 +1893,11 @@ lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after, /* Replace all references to register OLD_REGNO in *LOC with pseudo register NEW_REG. Try to simplify subreg of constant if SUBREG_P. - Return true if any change was made. */ + DEBUG_P is if LOC is within a DEBUG_INSN. Return true if any + change was made. */ bool -lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg, bool subreg_p) +lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg, bool subreg_p, + bool debug_p) { rtx x = *loc; bool result = false; @@ -1931,11 +1933,14 @@ lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg, bool subreg_p) if (mode != inner_mode && ! (CONST_INT_P (new_reg) && SCALAR_INT_MODE_P (mode))) { - if (!partial_subreg_p (mode, inner_mode) - || ! SCALAR_INT_MODE_P (inner_mode)) - new_reg = gen_rtx_SUBREG (mode, new_reg, 0); + poly_uint64 offset = 0; + if (partial_subreg_p (mode, inner_mode) + && SCALAR_INT_MODE_P (inner_mode)) + offset = subreg_lowpart_offset (mode, inner_mode); + if (debug_p) + new_reg = gen_rtx_raw_SUBREG (mode, new_reg, offset); else - new_reg = gen_lowpart_SUBREG (mode, new_reg); + new_reg = gen_rtx_SUBREG (mode, new_reg, offset); } *loc = new_reg; return true; @@ -1948,14 +1953,14 @@ lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg, bool subreg_p) if (fmt[i] == 'e') { if (lra_substitute_pseudo (&XEXP (x, i), old_regno, - new_reg, subreg_p)) + new_reg, subreg_p, debug_p)) result = true; } else if (fmt[i] == 'E') { for (j = XVECLEN (x, i) - 1; j >= 0; j--) if (lra_substitute_pseudo (&XVECEXP (x, i, j), old_regno, - new_reg, subreg_p)) + new_reg, subreg_p, debug_p)) result = true; } } @@ -1970,7 +1975,8 @@ lra_substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, rtx new_reg, bool subreg_p) { rtx loc = insn; - return lra_substitute_pseudo (&loc, old_regno, new_reg, subreg_p); + return lra_substitute_pseudo (&loc, old_regno, new_reg, subreg_p, + DEBUG_INSN_P (insn)); } |