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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Alex Coplan
<acop...@gcc.gnu.org>:

https://gcc.gnu.org/g:1a4f1e5f91a69434f2ec0d95c91bad2c928dcff3

commit r14-11386-g1a4f1e5f91a69434f2ec0d95c91bad2c928dcff3
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Wed Mar 5 12:18:20 2025 +0000

    aarch64: Check for invalid use arrays in ldp_fusion [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.

    This is a backport of
    r15-7282-gf559ac896942ffe0e2315d0a4d8b8b517a16d607.

    gcc/
            PR rtl-optimization/118320
            * config/aarch64/aarch64-ldp-fusion.cc (ldp_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.

    Co-authored-by: Alex Coplan <alex.cop...@arm.com>

Reply via email to