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

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

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

commit r16-6062-ge1b8d097297d6375eb42fc05b46dc13236a63404
Author: Jakub Jelinek <[email protected]>
Date:   Fri Dec 12 15:18:08 2025 +0100

    rtlanal: Use REG_UNUSED notes in single_set only in passes where df_analyze
has computed them [PR121852]

    REG_UNUSED and REG_DEAD notes are only valid when computed by df
    with df_note_add_problem () before df_analyze ().
    Generally, especially CSE/GCSE optimizations can invalidate those
    notes by reusing the REG_UNUSED results later on, unfortunately dropping
    REG_UNUSED notes in such cases is not very easy.
    See e.g. PR113059 and PR40209 for additional details.

    Most users of REG_UNUSED/REG_DEAD notes add the note problems, but
    single_set function is called from many of the passes and requiring
    that df_note_add_problem () is done in each such a case would be very
    slow and would need some checking.

    The following patch instead limits the use of REG_UNUSED notes to
    passes which have the note problem computed (i.e. df && df_note), and
    for pseudos as a fallback uses DF_REG_USE_COUNT == 0 check if at least
    df is computed.

    2025-12-12  Jakub Jelinek  <[email protected]>

            PR rtl-optimization/121852
            * rtlanal.cc (single_set_2): Only look for REG_UNUSED notes if
            df && df_note, otherwise if df and SET_DEST is a pseudo with
            DF_REG_USE_COUNT 0, assume it is unused as well.  Otherwise
            assume it may be used.

            * gcc.dg/pr121852.c: New test.

Reply via email to