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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>:

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

commit r15-7282-gf559ac896942ffe0e2315d0a4d8b8b517a16d607
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Thu Jan 30 08:59:30 2025 +0000

    pair-fusion: Check for invalid use arrays [PR118320]

    As Andrew says in the bugzilla comments, this PR is about a case where
    we tried to fuse two stores of x0, one in which x0 was defined and one
    in which it was undefined.  merge_access_arrays failed on the conflict,
    but the failure wasn't caught.

    Normally the hazard detection code would fail if the instructions
    had incompatible uses.  However, an undefined use doesn't impose
    many restrictions on movements.  I think this is likely to be the
    only case where hazard detection isn't enough.

    As Andrew notes in bugzilla, it might be possible to allow uses
    of defined and undefined values to be merged to the defined value.
    But that sounds dangerous in the general case, as an rtl-ssa-level
    decision.  We might run the risk of turning conditional UB into
    unconditional UB.  And LLVM proves that the definition of "undef"
    isn't simple.

    gcc/
            PR rtl-optimization/118320
            * pair-fusion.cc (pair_fusion_bb_info::fuse_pair): Commonize
            the merge of input_uses and return early if it fails.

    gcc/testsuite/
            PR rtl-optimization/118320
            * g++.dg/torture/pr118320.C: New test.

Reply via email to