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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:589c94da22ec71fe8518878e801e88b05deffe18

commit r15-8493-g589c94da22ec71fe8518878e801e88b05deffe18
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Mar 21 12:17:45 2025 +0100

    fnsplit: Set musttail call during function splitting if there are musttail
calls [PR119376]

    The just posted inliner patch can regress musttail calls if we perform
    function splitting and then inline the outlined body back into the original
    (or inline both the small function and outlined large body into something
    else).
    If there are any musttail calls, I think we need to call the outlined
    body using a musttail call, so that the inliner will preserve musttail
    attributes in the body.

    2025-03-21  Jakub Jelinek  <ja...@redhat.com>

            PR ipa/119376
            * ipa-split.cc (split_function): Call gimple_call_set_must_tail
            on the call to outlined partition if has_musttail and
            !add_tsan_func_exit.

            * g++.dg/opt/musttail1.C: New test.

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:28caa267dc757d80ffe37d638d981d3572c164ae

commit r15-8494-g28caa267dc757d80ffe37d638d981d3572c164ae
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Mar 21 12:18:35 2025 +0100

    icf: Punt for musttail call flag differences in ICF [PR119376]

    The following testcase shows we were ignoring musttail flags on calls
    when deciding if two functions are the same.
    That can result in problems in both directions, either we silently
    lose musttail attribute because there is a similar function without it
    earlier and then we e.g. don't diagnose if it can't be tail called
    or don't try harder to do a tail call, or we get it even in functions
    which didn't have it before.

    The following patch for now just punts if it differs.  Perhaps we could
    just merge it and get musttail flag if any of the merged functions had
    one in such position, but it feels to me that it is now too late in GCC 15
    cycle to play with this.

    2025-03-21  Jakub Jelinek  <ja...@redhat.com>

            PR ipa/119376
            * ipa-icf-gimple.cc (func_checker::compare_gimple_call): Return
false
            for gimple_call_must_tail_p mismatches.

            * c-c++-common/musttail27.c: New test.

Reply via email to