public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405
@ 2022-09-17  6:06 asolokha at gmx dot com
  2022-09-17  6:08 ` [Bug target/106959] " asolokha at gmx dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-09-17  6:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106959
           Summary: [13 Regression] ICE in curr_insn_transform, at
                    lra-constraints.cc:4168 (error: unable to generate
                    reloads), or ICE in simplify_subreg, at
                    simplify-rtx.cc:7405
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
                CC: sayle at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-unknown-linux-gnu

1. gcc 13.0.0 20220911 snapshot (g:0ea5e3f4542832b8da016b152695e64a2a386309)
ICEs when compiling the following testcase w/ -msse4 -O2 -fno-tree-loop-im
--param max-combine-insns=2:

unsigned __int128 n;

int
foo (int x)
{
  __int128 a = 0;
  int b = !!(n * 2);

  while (x < 2)
    {
      if (a)
        {
          if (n)
            n ^= 1;
          else
            x <<= 32;
        }

      a = 1;
    }

  return b;
}

% x86_64-unknown-linux-gnu-gcc-13.0.0 -msse4 -O2 -fno-tree-loop-im --param
max-combine-insns=2 -w -c nyxubvpd.c
nyxubvpd.c: In function 'foo':
nyxubvpd.c:23:1: error: unable to generate reloads for:
   23 | }
      | ^
(insn 8 7 62 2 (parallel [
            (set (reg:TI 90)
                (ashift:TI (reg:V1TI 96 [ n.1_4 ])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) "nyxubvpd.c":7:16 747 {ashlti3_doubleword}
     (expr_list:REG_DEAD (reg:V1TI 96 [ n.1_4 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
during RTL pass: reload
nyxubvpd.c:23:1: internal compiler error: in curr_insn_transform, at
lra-constraints.cc:4168
0x730822 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/rtl-error.cc:108
0x70a880 curr_insn_transform
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/lra-constraints.cc:4168
0xd41a2e lra_constraints(bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/lra-constraints.cc:5203
0xd2db02 lra(_IO_FILE*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/lra.cc:2375
0xce35d9 do_reload
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/ira.cc:5940
0xce35d9 execute
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/ira.cc:6126

2. W/o --param max-combine-insns=2, it yields the following instead:

% x86_64-unknown-linux-gnu-gcc-13.0.0 -msse4 -O2 -fno-tree-loop-im -w -c
nyxubvpd.c
during RTL pass: combine
nyxubvpd.c: In function 'foo':
nyxubvpd.c:23:1: internal compiler error: in simplify_subreg, at
simplify-rtx.cc:7405
   23 | }
      | ^
0x734cf5 simplify_context::simplify_subreg(machine_mode, rtx_def*,
machine_mode, poly_int<1u, unsigned long>)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/simplify-rtx.cc:7405
0x1cdb6ff simplify_subreg(machine_mode, rtx_def*, machine_mode, poly_int<1u,
unsigned long>)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/rtl.h:3498
0x1cdb6ff combine_simplify_rtx
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:5874
0x1cdd76e subst
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:5605
0x1cdd538 subst
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:5532
0x1cdd538 subst
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:5532
0x1cdd538 subst
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:5532
0x1ce0b22 try_combine
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:3336
0x1ce692c combine_instructions
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:1287
0x1ce692c rest_of_handle_combine
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:14978
0x1ce692c execute
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220911/work/gcc-13-20220911/gcc/combine.cc:15023

It is probably a duplicate of PR106933.

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
@ 2022-09-17  6:08 ` asolokha at gmx dot com
  2022-09-19  6:37 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-09-17  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Arseny Solokha <asolokha at gmx dot com> ---
(In reply to Arseny Solokha from comment #0)
>   __int128 a = 0;

No need for 'a' be __int128 here, int would suffice.

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
  2022-09-17  6:08 ` [Bug target/106959] " asolokha at gmx dot com
@ 2022-09-19  6:37 ` rguenth at gcc dot gnu.org
  2022-09-20  8:32 ` [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-19  6:37 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
   Target Milestone|---                         |13.0

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
  2022-09-17  6:08 ` [Bug target/106959] " asolokha at gmx dot com
  2022-09-19  6:37 ` rguenth at gcc dot gnu.org
@ 2022-09-20  8:32 ` marxin at gcc dot gnu.org
  2022-10-18  8:44 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-20  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
   Last reconfirmed|                            |2022-09-20
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
            Summary|[13 Regression] ICE in      |[13 Regression] ICE in
                   |curr_insn_transform, at     |curr_insn_transform, at
                   |lra-constraints.cc:4168     |lra-constraints.cc:4168
                   |(error: unable to generate  |(error: unable to generate
                   |reloads), or ICE in         |reloads), or ICE in
                   |simplify_subreg, at         |simplify_subreg, at
                   |simplify-rtx.cc:7405        |simplify-rtx.cc:7405 since
                   |                            |r13-2100-g5cccc24c06610d2f

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-2100-g5cccc24c06610d2f.

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-09-20  8:32 ` [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f marxin at gcc dot gnu.org
@ 2022-10-18  8:44 ` rguenth at gcc dot gnu.org
  2022-10-20 18:57 ` asolokha at gmx dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-18  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-10-18  8:44 ` rguenth at gcc dot gnu.org
@ 2022-10-20 18:57 ` asolokha at gmx dot com
  2022-10-20 22:55 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: asolokha at gmx dot com @ 2022-10-20 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Arseny Solokha <asolokha at gmx dot com> ---
Here's a shorter testcase that AFAICT doesn't rely on UB:

unsigned __int128 m;
int n;

__attribute__ ((simd)) void
foo (int x)
{
  x = n ? n : (short int) x;
  if (x)
    m /= 2;
}

gcc 13.0.0 20221016 snapshot ICEs on that w/ just -O2 -fpeel-loops (and,
optionally, --param max-combine-insns=2, as before).

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-10-20 18:57 ` asolokha at gmx dot com
@ 2022-10-20 22:55 ` hjl.tools at gmail dot com
  2022-12-23  9:52 ` cvs-commit at gcc dot gnu.org
  2022-12-24 17:29 ` roger at nextmovesoftware dot com
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-10-20 22:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 53738
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53738&action=edit
A patch

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-10-20 22:55 ` hjl.tools at gmail dot com
@ 2022-12-23  9:52 ` cvs-commit at gcc dot gnu.org
  2022-12-24 17:29 ` roger at nextmovesoftware dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-23  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:

https://gcc.gnu.org/g:24a7980d0f48671ea13da18c9162a43420b5af58

commit r13-4872-g24a7980d0f48671ea13da18c9162a43420b5af58
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Fri Dec 23 09:50:18 2022 +0000

    PR target/106933: Limit TImode STV to SSA-like def-use chains on x86.

    With many thanks to H.J. for doing all the hard work, this patch resolves
    two P1 regressions; PR target/106933 and PR target/106959.

    Although superficially similar, the i386 backend's two scalar-to-vector
    (STV) passes perform their transformations in importantly different ways.
    The original pass converting SImode and DImode operations to V4SImode
    or V2DImode operations is "soft", allowing values to be maintained in
    both integer and vector hard registers.  The newer pass converting TImode
    operations to V1TImode is "hard" (all or nothing) that converts all uses
    of a pseudo to vector form.  To implement this it invokes powerful ju-ju
    calling SET_MODE on a reg_rtx, which due to RTL sharing, often updates
    this pseudo's mode everywhere in the RTL chain.  Hence, TImode STV can only
    be performed when all uses of a pseudo are convertible to V1TImode form.
    To ensure this the STV passes currently use data-flow analysis to inspect
    all DEFs and USEs in a chain.  This works fine for chains that are in
    the usual single assignment form, but the occurrence of uninitialized
    variables, or multiple assignments that split a pseudo's usage into
    several independent chains (lifetimes) can lead to situations where
    some but not all of a pseudo's occurrences need to be updated.  This is
    safe for the SImode/DImode pass, but leads to the above bugs during
    the TImode pass.

    My one minor tweak to HJ's patch from comment #4 of bugzilla PR106959
    is to only perform the new single_def_chain_p check for TImode STV; it
    turns out that STV of SImode/DImode min/max operates safely on multiple-def
    chains, and prohibiting this leads to testsuite regressions.  We don't
    (yet) support V1TImode min/max, so this idiom isn't an issue during the
    TImode STV pass.

    For the record, the two alternate possible fixes are (i) make the TImode
    STV pass "soft", by eliminating use of SET_MODE, instead using replace_rtx
    with a new pseudo, or (ii) merging "chains" so that multiple DFA
    chains/lifetimes are considered a single STV chain.

    2022-12-23  H.J. Lu  <hjl.tools@gmail.com>
                Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR target/106933
            PR target/106959
            * config/i386/i386-features.cc (single_def_chain_p): New predicate
            function to check that a pseudo's use-def chain is in SSA form.
            (timode_scalar_to_vector_candidate_p): Check that TImode regs that
            are SET_DEST or SET_SRC of an insn match/are single_def_chain_p.

    gcc/testsuite/ChangeLog
            PR target/106933
            PR target/106959
            * gcc.target/i386/pr106933-1.c: New test case.
            * gcc.target/i386/pr106933-2.c: Likewise.
            * gcc.target/i386/pr106959-1.c: Likewise.
            * gcc.target/i386/pr106959-2.c: Likewise.
            * gcc.target/i386/pr106959-3.c: Likewise.

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

* [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f
  2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-12-23  9:52 ` cvs-commit at gcc dot gnu.org
@ 2022-12-24 17:29 ` roger at nextmovesoftware dot com
  7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2022-12-24 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at nextmovesoftware dot com
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Roger Sayle <roger at nextmovesoftware dot com> ---
This should now be fixed on mainline.  Thanks HJ and Uros.

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

end of thread, other threads:[~2022-12-24 17:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17  6:06 [Bug target/106959] New: [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 asolokha at gmx dot com
2022-09-17  6:08 ` [Bug target/106959] " asolokha at gmx dot com
2022-09-19  6:37 ` rguenth at gcc dot gnu.org
2022-09-20  8:32 ` [Bug target/106959] [13 Regression] ICE in curr_insn_transform, at lra-constraints.cc:4168 (error: unable to generate reloads), or ICE in simplify_subreg, at simplify-rtx.cc:7405 since r13-2100-g5cccc24c06610d2f marxin at gcc dot gnu.org
2022-10-18  8:44 ` rguenth at gcc dot gnu.org
2022-10-20 18:57 ` asolokha at gmx dot com
2022-10-20 22:55 ` hjl.tools at gmail dot com
2022-12-23  9:52 ` cvs-commit at gcc dot gnu.org
2022-12-24 17:29 ` roger at nextmovesoftware dot com

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).