diff options
author | Richard Sandiford <richard@codesourcery.com> | 2006-09-13 06:30:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2006-09-13 06:30:59 +0000 |
commit | 4b7b277aff44cffe643cff9b84d13968b29fa177 (patch) | |
tree | 2aa34947dc3602c792429dc6db53537ff293ce74 /gcc/reload.c | |
parent | 04df96dded18551448d76b9a753c83d917a8cebd (diff) | |
download | gcc-4b7b277aff44cffe643cff9b84d13968b29fa177.zip gcc-4b7b277aff44cffe643cff9b84d13968b29fa177.tar.gz gcc-4b7b277aff44cffe643cff9b84d13968b29fa177.tar.bz2 |
re PR rtl-optimization/28982 (Incorrect reloading of automodification expressions)
gcc/
PR rtl-optimization/28982
* reload.c (find_reloads_address_1): Use RELOAD_OTHER for the
index of a PRE_MODIFY or POST_MODIFY address.
* reload1.c (inc_for_reload): Use find_replacement on the original
base and index registers.
gcc/testsuite/
PR rtl-optimization/28982
* gcc.c-torture/execute/pr28982a.c: New test.
* gcc.c-torture/execute/pr28982b.c: Likewise.
From-SVN: r116919
Diffstat (limited to 'gcc/reload.c')
-rw-r--r-- | gcc/reload.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/reload.c b/gcc/reload.c index e1a4abc..1f1bc23 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -5541,12 +5541,18 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, /* Require index register (or constant). Let's just handle the register case in the meantime... If the target allows auto-modify by a constant then we could try replacing a pseudo - register with its equivalent constant where applicable. */ + register with its equivalent constant where applicable. + + If we later decide to reload the whole PRE_MODIFY or + POST_MODIFY, inc_for_reload might clobber the reload register + before reading the index. The index register might therefore + need to live longer than a TYPE reload normally would, so be + conservative and class it as RELOAD_OTHER. */ if (REG_P (XEXP (op1, 1))) if (!REGNO_OK_FOR_INDEX_P (REGNO (XEXP (op1, 1)))) find_reloads_address_1 (mode, XEXP (op1, 1), 1, code, SCRATCH, - &XEXP (op1, 1), opnum, type, ind_levels, - insn); + &XEXP (op1, 1), opnum, RELOAD_OTHER, + ind_levels, insn); gcc_assert (REG_P (XEXP (op1, 0))); |