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

--- Comment #2 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:a494791eb67c7d1e4f5a455f05d1ca20999cf9a2

commit r17-7089-ga494791eb67c7d1e4f5a455f05d1ca20999cf9a2
Author: Oleksandr Kulkov <[email protected]>
Date:   Thu Oct 8 20:54:00 2026 +0200

    ipa: Allow inlining expanded target_clones [PR95796]

    This fixes the missed inlining reported in PR ipa/95796:
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95796
    Functions with matching target_clones attributes remain uninlinable
    after their versions are generated.

    The C-family target_clones attribute handler sets DECL_UNINLINABLE.
    Generated versions inherit that flag, preventing inlining even after
    matching caller and callee versions have been selected.

    Reject inlining while the target_clones attribute is present, without
    caching that temporary restriction in DECL_UNINLINABLE. Once version
    expansion replaces the attribute, the usual inlining checks apply.

    Add C and C++ checks for inlining matching versions and a negative check
    for different target lists. Keep the PR95778 call-routing tests focused
    on their existing assertions by marking their callees noinline.

    Bootstrapped all default languages and regression-tested on
    x86_64-pc-linux-gnu with multilib enabled, including make -k check and
    check-c++-all. No new unexpected failures compared with unmodified
    7d652a985309ac5cd1492a505805bbd2c3781598.

    OK for trunk? If approved, please commit this on my behalf.

    Assisted-by: OpenAI Codex

    gcc/c-family/ChangeLog:

            PR ipa/95796
            * c-attribs.cc (handle_target_clones_attribute): Do not set
            DECL_UNINLINABLE for target_clones.

    gcc/ChangeLog:

            PR ipa/95796
            * tree-inline.cc (tree_inlinable_function_p): Reject an unexpanded
            target_clones function without caching the restriction.

    gcc/testsuite/ChangeLog:

            PR ipa/95796
            * g++.target/i386/pr95796-1.C: New test.
            * gcc.target/i386/pr95778-1.c (f2): Add noinline.
            * gcc.target/i386/pr95778-2.c (f2): Likewise.
            * gcc.target/i386/pr95796-1.c: New test.
            * gcc.target/i386/pr95796-3.c: New test.
            * gcc.target/i386/tct-ipa-inline-ice.c: Remove obsolete comment.

Reply via email to