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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Earnshaw <[email protected]>:

https://gcc.gnu.org/g:53bcce761283ac36217eacfaebae1b98dae49b81

commit r17-5193-g53bcce761283ac36217eacfaebae1b98dae49b81
Author: Richard Earnshaw <[email protected]>
Date:   Mon Oct 5 15:08:35 2026 +0100

    arm: rework minipool code to use subpools [PR127227]

    The Arm minipool code was orginally architected on the premise that all
    entries would have a common alignment of 32-bits.  Over time some changes
    were made to permit making the pool 64-bit aligned if the architecture
    preferred double-word alignment for some literals, but there have always
    been subtle bugs as a result; in particular I found while working on this
    code that we would carefully align the pool to 64 bits only to then insert
    a 16-bit literal (with a small range) at the head of the pool, breaking
    the layout assumptions for all subsequent entries.

    To address these issues I've re-architected the code to manage the pool as
    a set of subpools, where each subpool shares constants with a common
    alignment requirement (we still support entries that are larger than
    their aligment).

    Another issue that I identified in the old code was that when inserting
    backward references the code would check if an existing entry of the
    same constant could be moved to the back of the (sub)-pool.  If it couldn't
    then we would insert a new copy of the constant even if the existing
    entry was reachable.  We now check if the constant can be used in its
    current location within the pool and add a new entry only if we cannot
    do that.

    gcc/ChangeLog:
            PR target/127227

            * config/arm/minipool.cc (INCLUDE_ALGORITHM): Define.
            (print-rtl.h): Include it.
            (minipool_address): New typedef.
            (IS_MINIPOOL_ADDRESS_MIN): New define.
            (IS_MINIPOOL_ADDRESS_MAX): Likewise.
            (MINIPOOL_ADDRESS_MIN): Likewise.
            (MINIPOOL_ADDRESS_MAX): Likewise.
            (struct minipool_node): Use minipool_address for address entries.
            (struct minipool_fixup): Likewise.
            (class subpool): New class.
            (class minipool): Rework to use subpools.
            (subpool::subpool): New constructor.
            (subpool::reset): New function.
            (subpool::update_bounds): New function.
            (subpool::move_fix_forward_ref): New function.
            (subpool::add_forward_ref): New function.
            (subpool::move_fix_backward_ref): New function.
            (subpool::add_backward_ref): New function.
            (subpool::assign_offsets): New function.
            (subpool::dump): New function.
            (subpool::debug): New function.
            (minipool::minipool): New constructor.
            (minipool::minipool): New function.
            (minipool::label): New function.
            (minipool::get_label_padding): Converted form get_label_padding.
            (minipool::get_alignment_size): Converted from get_alignment_size.
            (minipool::find_subpool): New function.
            (minipool::add_forward_ref): Rework for subpools.
            (minipool::add_backward_ref): Likewise.
            (minipool::assign_offsets): Likewise.
            (minipool::dump): Rework for subpools.
            (minipool::create_fix_barrier): Converted from create_fix_barrier.
            (minipool::debug): New function.
            (place_minipools): Rework for subpools.

Reply via email to