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

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>:

https://gcc.gnu.org/g:be547188b632d8c1072341c431af339b7384c4a6

commit r16-1720-gbe547188b632d8c1072341c431af339b7384c4a6
Author: Alexandre Oliva <ol...@adacore.com>
Date:   Thu Jun 26 21:01:22 2025 -0300

    [lra] recompute ranges upon disabling fp2sp elimination [PR120424]

    If the frame size grows to nonzero, arm_frame_pointer_required may
    flip to true under -fstack-clash-protection -fnon-call-exceptions, and
    that may disable the fp2sp elimination part-way through lra.

    If pseudos had got assigned to the frame pointer register before that,
    they have to be spilled, and that requires complete live range
    information.  If !lra_reg_spill_p, lra_spill won't have live ranges
    for such pseudos, and they could end up sharing spill slots with other
    pseudos whose live ranges actually overlap.

    This affects at least Ada.Strings.Wide_Superbounded.Super_Insert and
    .Super_Replace_Slice in libgnat/a-stwisu.adb, when compiled with -O2
    -fstack-clash-protection -march=armv7 (implied Thumb2), causing
    acats-4's cdd2a01 to fail.

    Recomputing live ranges including registers may renumber and compress
    points, so we have to recompute the aggregated live ranges for
    already-assigned spill slots as well.

    As a safety net, reject empty live ranges when computing slot sharing.


    for  gcc/ChangeLog

            PR rtl-optimization/120424
            * lra-eliminations.cc (lra_update_fp2sp_elimination):
            Compute complete live ranges and recompute slots' live ranges
            if needed.
            * lra-lives.cc (lra_reset_live_range_list): New.
            (lra_complete_live_ranges): New.
            * lra-spills.cc (assign_spill_hard_regs): Reject empty live
            ranges.
            (add_pseudo_to_slot): Likewise.
            (lra_recompute_slots_live_ranges): New.
            * lra-int.h (lra_reset_live_range_list): Declare.
            (lra_complete_live_ranges): Declare.
            (lra_recompute_slots_live_ranges): Declare.

Reply via email to