https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116236
--- Comment #21 from Michael Matz <matz at gcc dot gnu.org> --- (In reply to Richard Sandiford from comment #17) > > But if LRA needs to be extended for correctness, then, ... meh. > But this is how it's always worked. The corresponding reload code is in > find_reloads_address_1, which similarly tries to tear apart an address, work > out whether something is a base or an index, and use that to calculate the > appropriate register class. ISTM this PR is just about an inconsistency > between the base/index identification in LRA vs reload. > > The reg_renumber indirection performed by GO_IF_LEGITIMATE_ADDRESS for > reload only handled the initial register allocation. It didn't help for > pseudos that were spilled, or were allocated to the wrong class. The > BASE_REG_CLASS/INDEX_REG_CLASS mechanism was always required to work for > correctness, not just optimisation. Yes, and I can't say that I ever liked it very much in reload either (for basically the same reasons I'm whining now here) :-) Perhaps I have just hoped LRA would come up with some other solution. Anyway, yes handling the decomposition in just the right way in LRA/rtlanal fixes the problem, so case closed.