diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2009-09-22 18:31:26 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2009-09-22 18:31:26 +0000 |
commit | 502a1e45907d04b3feeec2b3e5e5b80a10e9350f (patch) | |
tree | 9dde6d6dc8a7b6817d099f383f6f5f1bc6362a4f /gcc/reload1.c | |
parent | ae6032ea4880e135775d84297e37a44891a343d7 (diff) | |
download | gcc-502a1e45907d04b3feeec2b3e5e5b80a10e9350f.zip gcc-502a1e45907d04b3feeec2b3e5e5b80a10e9350f.tar.gz gcc-502a1e45907d04b3feeec2b3e5e5b80a10e9350f.tar.bz2 |
re PR debug/41295 (gfortran.dg/loc_2.f90 -O3 -g fails on SH with orphaned debug_insn)
gcc/ChangeLog:
PR debug/41295
* reload1.c (reload): Reset debug insns with pseudos without
equivalences.
gcc/testsuite/ChangeLog:
PR debug/41295
* gcc.dg/pr41295.c: New.
From-SVN: r152040
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r-- | gcc/reload1.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index fae95d6..5581cd6 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1241,40 +1241,54 @@ reload (rtx first, int global) { rtx reg = regno_reg_rtx[i]; rtx equiv = 0; - df_ref use; + df_ref use, next; if (reg_equiv_constant[i]) equiv = reg_equiv_constant[i]; else if (reg_equiv_invariant[i]) equiv = reg_equiv_invariant[i]; else if (reg && MEM_P (reg)) - { - equiv = targetm.delegitimize_address (reg); - if (equiv == reg) - equiv = 0; - } + equiv = targetm.delegitimize_address (reg); else if (reg && REG_P (reg) && (int)REGNO (reg) != i) equiv = reg; - if (equiv) - for (use = DF_REG_USE_CHAIN (i); use; - use = DF_REF_NEXT_REG (use)) - if (DEBUG_INSN_P (DF_REF_INSN (use))) + if (equiv == reg) + continue; + + for (use = DF_REG_USE_CHAIN (i); use; use = next) + { + rtx *loc = DF_REF_LOC (use); + rtx x = *loc; + + insn = DF_REF_INSN (use); + next = DF_REF_NEXT_REG (use); + + if (DEBUG_INSN_P (insn)) { - rtx *loc = DF_REF_LOC (use); - rtx x = *loc; - - if (x == reg) - *loc = copy_rtx (equiv); - else if (GET_CODE (x) == SUBREG - && SUBREG_REG (x) == reg) - *loc = simplify_gen_subreg (GET_MODE (x), equiv, - GET_MODE (reg), - SUBREG_BYTE (x)); + gcc_assert (x == reg + || (GET_CODE (x) == SUBREG + && SUBREG_REG (x) == reg)); + + if (!equiv) + { + INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC (); + df_insn_rescan_debug_internal (insn); + } else - gcc_unreachable (); - *loc = wrap_constant (GET_MODE (x), *loc); + { + if (x == reg) + *loc = copy_rtx (equiv); + else if (GET_CODE (x) == SUBREG + && SUBREG_REG (x) == reg) + *loc = simplify_gen_subreg (GET_MODE (x), equiv, + GET_MODE (reg), + SUBREG_BYTE (x)); + else + gcc_unreachable (); + *loc = wrap_constant (GET_MODE (x), *loc); + } } + } } } |