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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:3c135697fd5f79db0954a79a48dcbba657e93f2e

commit r13-6131-g3c135697fd5f79db0954a79a48dcbba657e93f2e
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sat Feb 18 12:40:04 2023 +0100

    i386: Fix up replacement of registers in certain peephole2s [PR108832]

    As mentioned in the PR, replace_rtx has 2 modes, one that only replaces
    x == from with to, the other which i386.md uses which also replaces
    REGNO (x) == REGNO (from) with to if both are REGs, but assert they have
    the same mode.  This is reasonable behavior if one replaces from with
    some other expression, say constant etc., but ICEs whenever the register
    appears in a different mode, which happens e.g. on the following testcase,
    where from/to has DImode but inside of the operands we have SImode of
    the from register.  replace_rtx also does some limited simplifications
    (though far less than simplify_replace_fn_rtx), which is needed if
    from a REG is replaced say with CONST_INT, but the peephole2s that use
    this only replace one REG with another one.

    The following patch introduces a new backend function for this, avoids
doing
    any simplifications and just replaces the REGs, for safety on a copy of
    the expression if any changes will be needed.

    2023-02-18  Jakub Jelinek  <ja...@redhat.com>

            PR target/108832
            * config/i386/i386-protos.h (ix86_replace_reg_with_reg): Declare.
            * config/i386/i386-expand.cc (ix86_replace_reg_with_reg): New
            function.
            * config/i386/i386.md: Replace replace_rtx calls in all peephole2s
            with ix86_replace_reg_with_reg.

            * gcc.target/i386/pr108832.c: New test.

Reply via email to