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

--- Comment #14 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:b49473448966b045460a23794ed9a309e503fa3b

commit r16-1721-gb49473448966b045460a23794ed9a309e503fa3b
Author: Alexandre Oliva <ol...@adacore.com>
Date:   Thu Jun 26 21:01:24 2025 -0300

    [lra] rework deactivation of fp2sp elimination [PR120424]

    Deactivating the fp2sp elimination in lra_update_fp2sp_elimination
    prevents update_reg_eliminate from propagating the fp2sp elimination
    offset to the next chosen elimination, so it may retain -1 as the
    prev_offset, and prev_offset will be taken as an already-applied
    offset that needs to be compensated in the next round of spilling and
    reloading.  This affects, for example, crtbegin.o's
    __do_global_dtors_aux on arm-linux-gnueabihf in a {BOOT_C,T}FLAGS='-O2
    -g -fnon-call-exceptions -fstack-clash-protection' bootstrap.

    Alas, just retaining that elimination causes spills to use the fp2sp
    elimination, including applying sp offsets, which breaks e.g. an
    x86_64-linux-gnu native bootstrap with ix86_frame_pointer_required
    modified to return true on nonzero frame size.

    The middle-ground solution is to keep the elimination active, so that
    its offsets are applied and propagated on to the subsequent fp
    elimination, but without introducing sp offsets, so that
    e.g. pr103973-18.c on the modified x86_64-linux-gnu doesn't get
    adjacent argument pushes of two adjacent on-stack temporaries ending
    up pushing the same temporary because of undesired adjustments.


    for  gcc/ChangeLog

            PR rtl-optimization/120424
            * lra-eliminations.cc (lra_update_fp2sp_elimination):
            Avoid sp offsets in further fp2sp eliminations...
            (update_reg_eliminate): ... and restore to_rtx before assert
            checking.

Reply via email to