On Dec  6, 2025, Alexandre Oliva <[email protected]> wrote:

> When processing stores for e.g. parameters passed on the stack, as in
> gcc.dg/pr117239.c, each store invalidates other stores pertaining to
> the same argument, because we can tell they refer to the same object,
> but not that the offsets don't overlap.  The reason for that is that
> the mem_rtx being invalidated is canonicalized to an SP offset, while
> those in the cselib table have canonical values as addresses, and
> alias.cc can't resolve SP to values to compare the offsets.

I withdraw the patch:

>       * cselib.cc (cselib_invalidate_mem): Lookup the address as
>       part of canonicalizing it.

because base terms aren't preserved in cselib, and even with WIP code to
preserve them, when stack and frame pointer differ by a constant, they
end up in the same cluster of VALUEs, but alias.cc wants them to have
different base terms.

I suppose one way to improve on this is for the frame pointer after
reload to share the base term with the stack pointer.  This would also
prevent the sp restore from bp to cause sp's reg_value to be reset, and
avoid the need for special-casing of the bp set up from sp.  Would such
a change be desirable/acceptable?

Is there interest in code to preserve base terms in cselib tables?

-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to