https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120424

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2025-06-26
         Resolution|DUPLICATE                   |---
             Target|arm-none-eabi               |arm-none-eabi,
                   |                            |arm-linux-gnueabihf

--- Comment #10 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
The initial testcase wasn't the only circumstance in which disabling the fp2sp
elimination part-way through lra caused wrong code to be generated.

There are various other lra-elimination issues that come up on
arm-linux-gnueabihf with -fnon-call-exceptions -fstack-clash-protection, and on
x86_64-linux-gnu with ix86_frame_pointer_required modified to return true on
nonzero frame size, even with -maccumulate-outgoing-args, that I've pursued as
part of this PR, so I'm hereby widening its scope beyond that of pr 118939,
reopening it, and summarizing its current status.

I've uploaded patches for the known issues to branch
users/aoliva/heads/lra-elim-fp2sp:

* The initial patch for this PR, that forces lra to update reg info after
spilling pseudos to memory.  Already installed as r16-1065.

* Introduce an armv7 requirement in the pr120424.C testcase, fixing an error
reported by the linaro CI. 
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687103.html

* Inactivate the fp2sp elimination as soon as we disable it, so that it can't
be used for spilling.  Fixes avr regression, but introduces arm-linux-gnueabihf
crtbegin.o build error (with the triggering flags).  Approved but not merged
yet.  https://gcc.gnu.org/pipermail/gcc-patches/2025-June/685893.html

* Compute complete live ranges before spilling the frame pointer, so that we
have information to decide slot assignment of pseudos already assigned to the
frame pointer.  Fixes libgnat's a-stwisu Ada.String.Wide_Superbounded,
miscompiled because of incorrect sharing of slots by spilled pseudos.  Approved
but not merged yet. 
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687095.html

* Make scratch registers eliminable, so that they get correct offsets before
being split out to reload insns, otherwise they may only get incrementally
adjusted.  Fixes acats-4 support fdd2a00.read miscompilation that overwrites
the register save area because of incorrect offsets. 
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687236.html

* Rework the deactivation of the fp2sp elimination, so that the offsets
computed in earlier elimination rounds get propagated to the newly-selected
elimination, if any.  Without that, the newly-selected elimination may keep a
-1 prev_offset, that will be considered applied, and thus cause incorrect
offsets.  This fixes the crtbegin.o miscompilation in arm-linux-gnueabihf
native bootstrap with the triggering flags (__do_global_dtors_aux gets an
incorrect, off-by-one fp offset). 
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687237.html

* Cleanup lra_update_fp2sp_eliminations.  No behavior change, only improving
readability by regrouping related operations, after earlier patches made it a
bit of a mess.  https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687238.html

* Apply elimination offsets to spilled pseudos in autoinc addresses.  Without
this, gmp's gen-fac crashes in the bootstrap version of mpz_and because an
autoinc pseudo used in a loop doesn't get properly offset at first, and
subsequent elimination rounds consider the needed offset already applied.  This
enables the arm-linux-gnueabihf bootstraps with triggering flags to succeed. 
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687239.html

* Catch and report eliminations to sp with nonzero offsets that aren't fp2sp
eliminations, when eliminations to sp become unavailable part-way through lra. 
About to be posted as a followup to
https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687546.html

Reply via email to