https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116326
Richard Sandiford <rsandifo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu.org
--- Comment #2 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
This is caused by the final entry in ELIMINABLE_REGS:
{ FRAME_POINTER_REGNUM + 1, STACK_POINTER_REGNUM + 1 }
I guess this was added to work around a reload bug involving multi-register
pointers, but it shouldn't be necessary for LRA (and as this PR shows, it's
actively harmful for LRA).
LRA treats each entry in ELIMINABLE_REGS as a pointer of mode Pmode. This
means that (as far as LRA is concerned) the final entry above occupies
FRAME_POINTER_REGNUM + 1 and FRAME_POINTER_REGNUM + 2. But
FRAME_POINTER_REGNUM + 2 is the Z register, so this takes the Z register out of
action, leading to a reload loop.
I'm sure there are lingering bugs around multi-register pointers :) But I
think we should remove the entry above and try to fix the bugs at source.