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

--- Comment #22 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <[email protected]>:

https://gcc.gnu.org/g:431453e3364bde20f3c6af72300137321bd98420

commit r16-7756-g431453e3364bde20f3c6af72300137321bd98420
Author: Martin Jambor <[email protected]>
Date:   Fri Feb 27 14:26:13 2026 +0100

    ipa-prop: Reset param_index of indir. edge when there are no jfuncs
(PR123229)

    In my commit r16-6149-g14ee9a2b41bafa I have added an early exit to
    update_indirect_edges_after_inlining which was however wrong, as
    demonstrated by the PR123229 testcase.  This patch reverts that change,
    restoring the previous behavior in this regard.

    In the testcase, the edge being inlined is a call to a thunk, which do
    not have jump functions associated with them.  This means that with
    the early exit we neither reset the parameter index associated with
    the indirect edge nor update the edges and the usage flags associated
    with them

    In the testcase, this meant that the param_used_by_indirect_call flag
    was not updated, which in turn meant that the inlining edge cost cache
    did not copy necessary information into the context which led to the
    fact that two contexts which were not the same were considered the
    same, and the checking code that evaluations in the cache should match
    a re-evaluation triggered.  But unfortunately this bug can probably
    have all sorts of weird and unexpected consequences.

    The testcase also shows that inlined thunks are a barrier to
    devirtualization which is something I will try to address next stage1.

    gcc/ChangeLog:

    2026-02-27  Martin Jambor  <[email protected]>

            PR ipa/123229
            * ipa-prop.cc (update_indirect_edges_after_inlining): Reset
parameter
            index associated with an indirect edge if the inlined edge does not
            have any jump functions.

    gcc/testsuite/ChangeLog:

    2026-02-27  Martin Jambor  <[email protected]>

            PR ipa/123229
            * g++.dg/ipa/pr123229.C: New test.

Reply via email to