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

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

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

commit r17-6003-gc147997f4f3adbaa91f4f8772dbe0ed32144076f
Author: Uros Bizjak <[email protected]>
Date:   Thu Nov 5 14:35:53 2026 +0100

    i386: Remove dead TLS local-dynamic base calls in ix86_reorg [PR128437]

    The 64-bit TLS local-dynamic base sequence is a const call to
    __tls_get_addr.  When its last @dtpoff user is dead, the fast DCE run
    from sched2 deletes that user but keeps the call; DCE doesn't delete
    calls while df is in progress, and no DCE pass runs after sched2.  The
    remaining call's output template uses '%&', which scans the insn
    stream for a local-dynamic TLS symbol, finds none and ICEs.

    Remove such calls in ix86_reorg, which runs after sched2, when their
    result is unused.  Calls whose result is still used are left alone, so
    '%&' keeps finding the symbol of the remaining references.  The 32-bit
    sequences are not calls and are deleted by DCE together with their
    users.

    Assisted-by: Claude Sonnet 5.5

            PR target/128437

    gcc/ChangeLog:

            * config/i386/i386.cc (ix86_remove_dead_tls_ld_base): New function.
            (ix86_reorg): Call it for 64-bit targets with GNU TLS
            when optimizing and TLS calls were expanded.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/pr128437.C: New test.

Reply via email to