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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

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

commit r13-6706-gadb70c2d1060b3e8d410b45c698796c5d88818b3
Author: Richard Biener <rguent...@suse.de>
Date:   Wed Mar 15 11:41:20 2023 +0100

    Avoid random stmt order result in pass_waccess::use_after_inval_p

    use_after_inval_p uses stmt UIDs to speed up repeated dominance
    checks within a basic-block but it fails to assign UIDs to PHIs
    which means compares with PHIs in the same block get a random
    result.

    The following factors renumber_gimple_stmt_uids to expose a new
    renumber_gimple_stmt_uids_in_block we can share.

    But since we rely on processing even earlier PHIs to follow
    pointer adjustments (we look at those even if earlier) the patch
    also moves PHI handling out of the use_after_inval_p guard.
    This then also fixes PR109141.

            PR tree-optimization/109141
            * tree-dfa.h (renumber_gimple_stmt_uids_in_block): New.
            * tree-dfa.cc (renumber_gimple_stmt_uids_in_block): Split
            out from ...
            (renumber_gimple_stmt_uids): ... here and
            (renumber_gimple_stmt_uids_in_blocks): ... here.
            * gimple-ssa-warn-access.cc (pass_waccess::use_after_inval_p):
            Use renumber_gimple_stmt_uids_in_block to also assign UIDs
            to PHIs.
            (pass_waccess::check_pointer_uses): Process all PHIs.

Reply via email to