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

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

https://gcc.gnu.org/g:e21d0d74f8b6f23afb5cb74dfc34283c46c830d4

commit r17-6993-ge21d0d74f8b6f23afb5cb74dfc34283c46c830d4
Author: Dominic P <[email protected]>
Date:   Tue Dec 1 07:28:46 2026 +0000

    ipa-strub: Do not strub outlined assume bodies

    An assume body is never called and never runs; it is only optimized
    so that tree-assume can derive ranges from it.  Since
    r17-5625-g06c86ad9301 it no longer has the noipa attribute that kept
    it away from strub, so -fstrub=all and -fstrub=internal make every
    assume body an internal strub wrapper, and verify_gimple then fails on
    the wrapped clone.  Reading a strub variable in an assumption needs no
    option: strub_from_body_p then requires strub for the body, which ICEs
    the same way on trunk unless -fstrub=at-calls or -fstrub=disable is
    given, and gave "requires 'strub', but no viable 'strub' mode was
    found" before r17-5625.

    Otherwise the body is a non-strub context, as it always was before
    r17-5625.  An assumption calling an always_inline function that needs
    strub is rejected with "calling 'always_inline' 'strub' ... in
    non-'strub' context", and strub_inlinable_to_p keeps strub functions
    out of the body, so a helper declared with strub, or with -fstrub=all,
    at-calls or internal even a plain static inline helper, is not inlined
    and the assumption is lost.

    A body that never runs has nothing to scrub, and nothing it calls or
    inlines needs checking.  Give assume functions the callable mode, skip
    them in verify_strub, and let strub_inlinable_to_p inline any function
    into them.  Calls that stay in the body are still adjusted like those
    of any other callable function, as an at-calls callee has gained the
    watermark parameter.

    Assisted-by: Claude Opus 5.5 (Anthropic)
    Signed-off-by: Dominic P <[email protected]>

    gcc/ChangeLog:

            PR ipa/109112
            * ipa-strub.cc (compute_strub_mode): Return STRUB_CALLABLE for
            assume functions.
            (strub_inlinable_to_p): Return true if CALLER is an assume
            function.
            (verify_strub): Skip assume functions.

    gcc/testsuite/ChangeLog:

            PR ipa/109112
            * c-c++-common/strub-assume-1.c: New test.
            * c-c++-common/strub-assume-2.c: New test.
            * c-c++-common/strub-assume-3.c: New test.
            * c-c++-common/strub-assume-4.c: New test.

Reply via email to