public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
@ 2024-05-03 22:13 zhendong.su at inf dot ethz.ch
  2024-05-03 22:25 ` [Bug target/114942] [14/15 Regression] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2024-05-03 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114942
           Summary: ICE on valid code at -O1 with "-fno-tree-sra
                    -fno-guess-branch-probability": in
                    extract_constrain_insn, at recog.cc:2713
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a recent regression as it doesn't reproduce with 13.2 and
earlier.

Compiler Explorer: https://godbolt.org/z/av9hr4933

[648] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240503 (experimental) (GCC)
[649] %
[649] % gcctk -O1 -c -fno-tree-sra -fno-guess-branch-probability small.c
small.c: In function ‘main’:
small.c:21:1: error: insn does not satisfy its constraints:
   21 | }
      | ^
(insn 39 56 57 6 (parallel [
            (set (strict_low_part (reg:QI 2 cx [orig:108 f ] [108]))
                (ior:QI (subreg:QI (zero_extract:HI (reg/v:HI 2 cx [orig:108 f
] [108])
                            (const_int 8 [0x8])
                            (const_int 8 [0x8])) 0)
                    (reg:QI 0 ax [orig:121 _7 ] [121])))
            (clobber (reg:CC 17 flags))
        ]) "small.c":19:7 626 {*iorqi_exthi_1_slp}
     (nil))
during RTL pass: reload
small.c:21:1: internal compiler error: in extract_constrain_insn, at
recog.cc:2713
0x83dea6 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-trunk/gcc/rtl-error.cc:108
0x83ded2 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-trunk/gcc/rtl-error.cc:118
0x83c10c extract_constrain_insn(rtx_insn*)
        ../../gcc-trunk/gcc/recog.cc:2713
0xf55a67 check_rtl
        ../../gcc-trunk/gcc/lra.cc:2189
0xf5aef1 lra(_IO_FILE*, int)
        ../../gcc-trunk/gcc/lra.cc:2610
0xf0b1ff do_reload
        ../../gcc-trunk/gcc/ira.cc:5973
0xf0b1ff execute
        ../../gcc-trunk/gcc/ira.cc:6161
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[650] %
[650] % cat small.c
extern void a();
struct b {
  char c;
  char d;
} e;
int main() {
  struct b f = e;
  char i = 0;
 L1:
  if (!f.c)
    goto L2;
  if (e.c)
    a();
  else
    return 0;
  f.d = 0;
  i = 1 % ((1 & f.c) - 2);
 L2:
  f.c = ~(i & ~f.d);
  goto L1;
}

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

* [Bug target/114942] [14/15 Regression] ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
  2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
@ 2024-05-03 22:25 ` pinskia at gcc dot gnu.org
  2024-05-04  8:28 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-03 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-03
   Target Milestone|---                         |14.0
            Summary|ICE on valid code at -O1    |[14/15 Regression] ICE on
                   |with "-fno-tree-sra         |valid code at -O1 with
                   |-fno-guess-branch-probabili |"-fno-tree-sra
                   |ty": in                     |-fno-guess-branch-probabili
                   |extract_constrain_insn, at  |ty": in
                   |recog.cc:2713               |extract_constrain_insn, at
                   |                            |recog.cc:2713
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Version|unknown                     |15.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Looks like it was introduced with r14-5456-gb42a09b258c3ed .

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

* [Bug target/114942] [14/15 Regression] ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
  2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
  2024-05-03 22:25 ` [Bug target/114942] [14/15 Regression] " pinskia at gcc dot gnu.org
@ 2024-05-04  8:28 ` ubizjak at gmail dot com
  2024-05-05 19:32 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2024-05-04  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
This is the insn in question:

;; Alternative 1 is needed to work around LRA limitation, see PR82524.
 (define_insn_and_split "*<code>qi_ext<mode>_1_slp"
   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+Q,&Q"))
         (any_logic:QI
           (subreg:QI
             (match_operator:SWI248 3 "extract_operator"
               [(match_operand 2 "int248_register_operand" "Q,Q")
                (const_int 8)
                (const_int 8)]) 0)
           (match_operand:QI 1 "nonimmediate_operand" "0,!qm")))
    (clobber (reg:CC FLAGS_REG))]

When targeting alternative 1, reload should use some other register for operand
2.

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

* [Bug target/114942] [14/15 Regression] ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
  2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
  2024-05-03 22:25 ` [Bug target/114942] [14/15 Regression] " pinskia at gcc dot gnu.org
  2024-05-04  8:28 ` ubizjak at gmail dot com
@ 2024-05-05 19:32 ` ubizjak at gmail dot com
  2024-05-07  7:46 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2024-05-05 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
Reload starts with:

(insn 39 38 48 6 (parallel [
            (set (strict_low_part (subreg:QI (reg/v:HI 108 [ f ]) 0))
                (ior:QI (subreg:QI (zero_extract:HI (reg/v:HI 108 [ f ])
                            (const_int 8 [0x8])
                            (const_int 8 [0x8])) 0)
                    (reg:QI 121 [ _7 ])))
            (clobber (reg:CC 17 flags))
        ]) "pr114942.c":19:7 626 {*iorqi_exthi_1_slp}
     (expr_list:REG_DEAD (reg:QI 121 [ _7 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

      Choosing alt 1 in insn 39:  (0) &Q  (1) !qm  (2) Q {*iorqi_exthi_1_slp}

and then allocates:

(insn 39 56 57 6 (parallel [
            (set (strict_low_part (reg:QI 2 cx [orig:108 f ] [108]))
                (ior:QI (subreg:QI (zero_extract:HI (reg/v:HI 2 cx [orig:108 f
] [108])
                            (const_int 8 [0x8])
                            (const_int 8 [0x8])) 0)
                    (reg:QI 0 ax [orig:121 _7 ] [121])))
            (clobber (reg:CC 17 flags))
        ]) "pr114942.c":19:7 626 {*iorqi_exthi_1_slp}

not taking into account the earlyclobber of operand 0.

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

* [Bug target/114942] [14/15 Regression] ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
  2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2024-05-05 19:32 ` ubizjak at gmail dot com
@ 2024-05-07  7:46 ` rguenth at gcc dot gnu.org
  2024-05-08 17:11 ` vmakarov at gcc dot gnu.org
  2024-05-10 16:29 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|14.0                        |14.2

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.

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

* [Bug target/114942] [14/15 Regression] ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
  2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2024-05-07  7:46 ` rguenth at gcc dot gnu.org
@ 2024-05-08 17:11 ` vmakarov at gcc dot gnu.org
  2024-05-10 16:29 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vmakarov at gcc dot gnu.org @ 2024-05-08 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
I've started to work on this PR.  I hope a patch will be ready on this or the
next week.

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

* [Bug target/114942] [14/15 Regression] ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713
  2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2024-05-08 17:11 ` vmakarov at gcc dot gnu.org
@ 2024-05-10 16:29 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-10 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Vladimir Makarov <vmakarov@gcc.gnu.org>:

https://gcc.gnu.org/g:9585317f0715699197b1313bbf939c6ea3c1ace6

commit r15-364-g9585317f0715699197b1313bbf939c6ea3c1ace6
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Fri May 10 09:15:50 2024 -0400

    [PR114942][LRA]: Don't reuse input reload reg of inout early clobber
operand

      The insn in question has the same reg in inout operand and input
    operand.  The inout operand is early clobber.  LRA reused input reload
    reg of the inout operand for the input operand which is wrong.  It
    were a good decision if the inout operand was not early clobber one.
    The patch rejects the reuse for the PR test case.

    gcc/ChangeLog:

            PR target/114942
            * lra-constraints.cc (struct input_reload): Add new member
early_clobber_p.
            (get_reload_reg): Add new arg early_clobber_p, don't reuse input
            reload with true early_clobber_p member value, use the arg for new
            element of curr_insn_input_reloads.
            (match_reload): Assign false to early_clobber_p member.
            (process_addr_reg, simplify_operand_subreg, curr_insn_transform):
            Adjust get_reload_reg calls.

    gcc/testsuite/ChangeLog:

            PR target/114942
            * gcc.target/i386/pr114942.c: New.

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

end of thread, other threads:[~2024-05-10 16:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03 22:13 [Bug rtl-optimization/114942] New: ICE on valid code at -O1 with "-fno-tree-sra -fno-guess-branch-probability": in extract_constrain_insn, at recog.cc:2713 zhendong.su at inf dot ethz.ch
2024-05-03 22:25 ` [Bug target/114942] [14/15 Regression] " pinskia at gcc dot gnu.org
2024-05-04  8:28 ` ubizjak at gmail dot com
2024-05-05 19:32 ` ubizjak at gmail dot com
2024-05-07  7:46 ` rguenth at gcc dot gnu.org
2024-05-08 17:11 ` vmakarov at gcc dot gnu.org
2024-05-10 16:29 ` cvs-commit 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).