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

--- Comment #5 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:0968b2f46e731ddbe9fe61508330004ee0060645

commit r17-6346-g0968b2f46e731ddbe9fe61508330004ee0060645
Author: Richard Biener <[email protected]>
Date:   Mon Nov 16 19:02:59 2026 +0100

    tree-optimization/128637 - wrong-code with VN and multiple defs

    The following fixes miscompilations that result from partial-defs
    support in value-numbering where the issue is that we ultimately
    record a load combining multiple memory states into the expression
    hashtable where it resembles a single store that is not there in
    the IL.  Don't do that and skip expression insertion for loads
    value-numbered this way.

            PR tree-optimization/128637
            PR tree-optimization/128688
            * tree-ssa-sccvn.cc (vn_walk_cb_data::dummy_vr): New member.
            (vn_walk_cb_data::using_dummy_vr): Likewise.
            (vn_walk_cb_data::vn_walk_cb_data): Initialize using_dummy_vr.
            (vn_walk_cb_data::finish): Add parameter to indicate whether
            to insert an expression and use the dummy_vr if not.
            (vn_walk_cb_data::push_partial_def): Skip expression insertion.
            (vn_reference_lookup_pieces): Do not expose the dummy VR.
            (vn_reference_lookup): Likewise.
            (eliminate_dom_walker::eliminate_stmt): When there is no
            actual single store found avoid redundant store elimination.

            * gcc.dg/torture/pr128637-1.c: New testcase.
            * gcc.dg/torture/pr128637-2.c: Likewise.
            * gcc.dg/torture/pr128688.c: Likewise.

Reply via email to