If reload decides to create an automodification reload (POST_MODIFY, etc.),
inc_for_reload will not deal correctly with any reloads for the base and
index registers. This problem is related to:
2006-03-29 Paul Brook <firstname.lastname@example.org>
* reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators.
(inc_for_reload): Handle PRE_MODIFY and POST_MODIFY addresses.
...before which, any attempt to create PRE_MODIFY and POST_MODIFY
reloads would cause an ICE.
The symptoms are twofold. If an index register is reloaded from
a spill slot, you'll get an ICE such as:
error: unrecognizable insn:
(insn 481 479 482 3 (set (reg:SI 1 r1)
(plus:SI (reg:SI 1 r1)
(mem/c:SI (plus:SI (reg/f:SI 13 sp)
(const_int 176 [0xb0])) [25 pretmp.56+0 S4 A32]))) -1 (nil)
If the base register is reloaded from a spill slot, the modification
will be lost.
There is a third problem. Suppose there's a RELOAD_FOR_INPUT reload (A)
that reloads a PRE_MODIFY or POST_MODIFY and a reload (B) that reloads
the index of that PRE_MODIFY or POST_MODIFY. (B) will then be a
RELOAD_FOR_INPUT_ADDRESS. This is incorrect, as inc_for_reload might
only read the index _after_ setting (A)'s reload register, so (B)'s
reload register must live longer than a normal RELOAD_FOR_INPUT_ADDRESS
is required to.
Because Paul's patch is 4.2-only, and because POST_MODIFY reloads
would ICE before his patch, the bug is only a 4.2 regression in
the sense that an ice-on-valid-code bug can now sometimes be a
more serious wrong-code bug.
Created attachment 12211 [details]
This brute-force test fails with -O2 -mfloat-abi=softfp.
Subject: Bug 28982
Date: Wed Sep 13 06:30:59 2006
New Revision: 116919
* 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.c-torture/execute/pr28982a.c: New test.
* gcc.c-torture/execute/pr28982b.c: Likewise.