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

--- Comment #11 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:851ec9960b084ad37556ec627e6931e985e41a24

commit r15-2070-g851ec9960b084ad37556ec627e6931e985e41a24
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Tue Jul 16 15:31:17 2024 +0100

    recog: restrict paradoxical mode punning in insn_propagation [PR115901]

    In g:44fc801e97a8dc626a4806ff4124439003420b20 I'd extended
    insn_propagation to handle simple cases of hard-reg mode punning.
    One of the checks was that the new use mode occupied the same
    number of registers as the original definition mode.  However,
    as PR115901 shows, we need to avoid increasing the size of any
    registers in the punned "to" expression as well.

    Specifically, the test includes a DImode move from GPR x0 to
    a vector register, followed by a V2DI use of the vector register.
    The simplification would then create a V2DI spanning x0 and x1,
    manufacturing a new, unwanted use of x1.

    Checking for that kind of thing directly seems too cumbersome,
    and is not related to the original motivation (which was to improve
    handling of shared vector zeros on aarch64).  This patch therefore
    restricts the paradoxical case to constants.

    gcc/
            PR rtl-optimization/115901
            * recog.cc (insn_propagation::apply_to_rvalue_1): Restrict
            paradoxical mode punning to cases where "to" is constant.

    gcc/testsuite/
            PR rtl-optimization/115901
            * gcc.dg/torture/pr115901.c: New test.

Reply via email to