public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved
@ 2023-12-26 16:56 xen0n at gentoo dot org
  2023-12-26 19:35 ` [Bug target/113148] " xry111 at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: xen0n at gentoo dot org @ 2023-12-26 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113148
           Summary: 14.0 ICE: maximum number of generated reload insns per
                    insn achieved
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xen0n at gentoo dot org
                CC: chenglulu at loongson dot cn, xry111 at gcc dot gnu.org
  Target Milestone: ---
            Target: loongarch64

Created attachment 56947
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56947&action=edit
Minimized reproducer

I just discovered this ICE while building xwayland-23.2.3 on a mostly
up-to-date Gentoo, but I suspect the bug is present on vanilla GCC as well,
because I remember there are recently some refactoring around LoongArch FCC
handling.

The attached reproducer is minified from xwayland's mi/miarc.c with minor
modifications.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] 14.0 ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
@ 2023-12-26 19:35 ` xry111 at gcc dot gnu.org
  2023-12-26 19:42 ` xry111 at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-26 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-12-26
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] 14.0 ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
  2023-12-26 19:35 ` [Bug target/113148] " xry111 at gcc dot gnu.org
@ 2023-12-26 19:42 ` xry111 at gcc dot gnu.org
  2023-12-26 22:39 ` xry111 at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-26 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
A bug in loongarch_secondary_reload is causing an infinite loop:

diff --git a/gcc/config/loongarch/loongarch.cc
b/gcc/config/loongarch/loongarch.cc
index 5ffd06ce9be..c0a0af3dda5 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6951,7 +6951,8 @@ loongarch_secondary_reload (bool in_p ATTRIBUTE_UNUSED,
rtx x,
          return NO_REGS;
        }

-      if (reg_class_subset_p (rclass, FP_REGS) && MEM_P (x))
+      if (reg_class_subset_p (rclass, FP_REGS)
+         && (regno == -1 || MEM_P (x)))
        return GR_REGS;

       return NO_REGS;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] 14.0 ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
  2023-12-26 19:35 ` [Bug target/113148] " xry111 at gcc dot gnu.org
  2023-12-26 19:42 ` xry111 at gcc dot gnu.org
@ 2023-12-26 22:39 ` xry111 at gcc dot gnu.org
  2023-12-26 22:44 ` xry111 at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-26 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-Decembe
                   |                            |r/641443.html
           Keywords|                            |patch

--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641443.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] 14.0 ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
                   ` (2 preceding siblings ...)
  2023-12-26 22:39 ` xry111 at gcc dot gnu.org
@ 2023-12-26 22:44 ` xry111 at gcc dot gnu.org
  2023-12-26 22:45 ` [Bug target/113148] [14 Regression] " xry111 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-26 22:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #3)
> Patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641443.html

I've successfully built Xwayland with patched GCC.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] [14 Regression] ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
                   ` (3 preceding siblings ...)
  2023-12-26 22:44 ` xry111 at gcc dot gnu.org
@ 2023-12-26 22:45 ` xry111 at gcc dot gnu.org
  2023-12-27 11:02 ` cvs-commit at gcc dot gnu.org
  2023-12-27 11:03 ` xry111 at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-26 22:45 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
            Summary|14.0 ICE: maximum number of |[14 Regression] ICE:
                   |generated reload insns per  |maximum number of generated
                   |insn achieved               |reload insns per insn
                   |                            |achieved

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] [14 Regression] ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
                   ` (4 preceding siblings ...)
  2023-12-26 22:45 ` [Bug target/113148] [14 Regression] " xry111 at gcc dot gnu.org
@ 2023-12-27 11:02 ` cvs-commit at gcc dot gnu.org
  2023-12-27 11:03 ` xry111 at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-27 11:02 UTC (permalink / raw)
  To: gcc-bugs

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 <xry111@gcc.gnu.org>:

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

commit r14-6852-gf19ceb2d49afdfa527d2109476a3f1d383c47e1b
Author: Xi Ruoyao <xry111@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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/113148] [14 Regression] ICE: maximum number of generated reload insns per insn achieved
  2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
                   ` (5 preceding siblings ...)
  2023-12-27 11:02 ` cvs-commit at gcc dot gnu.org
@ 2023-12-27 11:03 ` xry111 at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-27 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Fixed for trunk.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-12-27 11:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-26 16:56 [Bug target/113148] New: 14.0 ICE: maximum number of generated reload insns per insn achieved xen0n at gentoo dot org
2023-12-26 19:35 ` [Bug target/113148] " xry111 at gcc dot gnu.org
2023-12-26 19:42 ` xry111 at gcc dot gnu.org
2023-12-26 22:39 ` xry111 at gcc dot gnu.org
2023-12-26 22:44 ` xry111 at gcc dot gnu.org
2023-12-26 22:45 ` [Bug target/113148] [14 Regression] " xry111 at gcc dot gnu.org
2023-12-27 11:02 ` cvs-commit at gcc dot gnu.org
2023-12-27 11:03 ` xry111 at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).