On 5/21/2026 8:06 AM, Konstantinos Eleftheriou wrote:
> The store_exprs_del vector was introduced in the PR119795 fix as a
> conservative safety measure alongside the actual bug fixes (adding
> forwardings.truncate(0) on vector mismatch and true_dependence
> detection).  It tracks deleted store candidates and blocks forwarding
> when a deleted store's range overlaps with the load.
>
> However, this check is not needed for correctness.  In the non-load-
> elimination path the load is kept and reads all bytes from memory;
> the bit-insert only overwrites forwarded bytes.  Deleted stores remain
> in the instruction stream, so their memory effects are visible to the
> load.  In the load-elimination path, all bytes must be covered by
> forwarded stores (enforced by the bitmap check), so missing stores
> cannot cause partial updates.
>
> The vector grows monotonically through the basic block and is scanned
> for each forwarding candidate, producing O(n^2) behavior for large
> basic blocks.
>
> Remove the mechanism entirely.  This eliminates the O(n^2) scan and
> simplifies the code.
>
> gcc/ChangeLog:
>
>       * avoid-store-forwarding.cc
>       (store_forwarding_analyzer::avoid_store_forwarding): Remove
>       store_exprs_del vector and all associated tracking.  Remove the
>       same_range_as_removed check from the forwarding loop.  Update
>       block comment.
>
> Signed-off-by: Konstantinos Eleftheriou <[email protected]>
OK
jeff

Reply via email to