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

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

https://gcc.gnu.org/g:9ded9b80c111559ece589197a17d6e7e512dd449

commit r16-5056-g9ded9b80c111559ece589197a17d6e7e512dd449
Author: Richard Biener <[email protected]>
Date:   Fri Oct 31 13:08:05 2025 +0100

    Make FOR_EACH_IMM_USE_STMT work w/o fake imm use node

    This is an attempt to fix PR122502 by making a FOR_EACH_IMM_USE_FAST
    with in an FOR_EACH_IMM_USE_STMT on _the same_ VAR work without
    the former running into the FOR_EACH_IMM_USE_STMT inserted marker
    use operand.  It does this by getting rid of the marker.

    The downside is that this in principle restricts the set of operations
    that can be done on the immediate use list of VAR.  Where previously
    almost anything was OK (but technically not well-defined what happens
    to the iteration) after this patch you may only remove immediate
    uses of VAR on the current stmt from the FOR_EACH_IMM_USE_STMT
    iteration.  In particular things will break if you happen to remove
    the one immediate use of VAR on the stmt immediately following
    the set of immediate uses on the currrent stmt.

    Additional checking to combat such cases is implemented in a
    followup.

            PR tree-optimization/122502
            * ssa-iterators.h (imm_use_iterator::iter_node): Remove.
            (imm_use_iterator::next_stmt_use): New.
            (next_readonly_imm_use): Adjust checking code.
            (end_imm_use_stmt_traverse): Simplify.
            (link_use_stmts_after): Likewise.  Return the last use
            with the same stmt.
            (first_imm_use_stmt): Simplify.  Set next_stmt_use.
            (next_imm_use_stmt): Likewise.
            (end_imm_use_on_stmt_p): Adjust.

            * gcc.dg/torture/pr122502-2.c: New testcase.

Reply via email to