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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Xi Ruoyao <xry...@gcc.gnu.org>:

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

commit r14-6852-gf19ceb2d49afdfa527d2109476a3f1d383c47e1b
Author: Xi Ruoyao <xry...@xry111.site>
Date:   Wed Dec 27 04:28:56 2023 +0800

    LoongArch: Fix infinite secondary reloading of FCCmode [PR113148]

    The GCC internal doc says:

         X might be a pseudo-register or a 'subreg' of a pseudo-register,
         which could either be in a hard register or in memory.  Use
         'true_regnum' to find out; it will return -1 if the pseudo is in
         memory and the hard register number if it is in a register.

    So "MEM_P (x)" is not enough for checking if we are reloading from/to
    the memory.  This bug has caused reload pass to stall and finally ICE
    complaining with "maximum number of generated reload insns per insn
    achieved", since r14-6814.

    Check if "true_regnum (x)" is -1 besides "MEM_P (x)" to fix the issue.

    gcc/ChangeLog:

            PR target/113148
            * config/loongarch/loongarch.cc (loongarch_secondary_reload):
            Check if regno == -1 besides MEM_P (x) for reloading FCCmode
            from/to FPR to/from memory.

    gcc/testsuite/ChangeLog:

            PR target/113148
            * gcc.target/loongarch/pr113148.c: New test.

Reply via email to