public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1
@ 2023-06-02  2:23 haochen.jiang at intel dot com
  2023-06-02  2:40 ` [Bug target/110083] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: haochen.jiang at intel dot com @ 2023-06-02  2:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110083
           Summary: [14 Regression] ICEs for testcase on
                    fp-int-convert*timode after r14-1466-g3635e8c67e1
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haochen.jiang at intel dot com
  Target Milestone: ---

Currently we get testcase regressions following:

https://gcc.gnu.org/pipermail/gcc-regression/2023-June/077808.html

I checked my bisect script, at least for fp-int-convert-timode.c, it points to
commit r14-1466-g3635e8c67e1 when using -march=cascadelake.

Actually, it will cause ICEs when using -msse4 and higher ISA set.

I reproduce it by:

/export/users/haochenj/env/build_no_bootstrap_master/gcc/xgcc
-B/export/users/haochenj/env/build_no_bootstrap_master/gcc/
/export/users/haochenj/src/gcc/master/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
-m64 -msse4 -fdiagnostics-plain-output -O2 -lm -o ./fp-int-convert-timode.exe

with backtrace:

during RTL pass: cse2
/export/users/haochenj/src/gcc/master/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c:
In function ‘main’:
/export/users/haochenj/src/gcc/master/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c:22:1:
internal compiler error: in as_a, at machmode.h:381
0xcc405f scalar_mode as_a<scalar_mode>(machine_mode)
        /export/users/haochenj/src/gcc/master/./gcc/machmode.h:381
0xf9eb33 wi::int_traits<std::pair<rtx_def*, machine_mode>
>::get_precision(std::pair<rtx_def*, machine_mode> const&)
        /export/users/haochenj/src/gcc/master/./gcc/rtl.h:2282
0xfb7fce unsigned int wi::get_precision<std::pair<rtx_def*, machine_mode>
>(std::pair<rtx_def*, machine_mode> const&)
        /export/users/haochenj/src/gcc/master/./gcc/wide-int.h:1795
0xfb21aa wide_int_ref_storage<false,
false>::wide_int_ref_storage<std::pair<rtx_def*, machine_mode>
>(std::pair<rtx_def*, machine_mode> const&)
        /export/users/haochenj/src/gcc/master/./gcc/wide-int.h:1029
0xfa7c7c generic_wide_int<wide_int_ref_storage<false, false>
>::generic_wide_int<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&)
        /export/users/haochenj/src/gcc/master/./gcc/wide-int.h:787
0x103f74b poly_int<1u, generic_wide_int<wide_int_ref_storage<false, false> >
>::poly_int<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&)
        /export/users/haochenj/src/gcc/master/./gcc/poly-int.h:670
0x103ef15 wi::to_poly_wide(rtx_def const*, machine_mode)
        /export/users/haochenj/src/gcc/master/./gcc/rtl.h:2382
0x1558c20 neg_poly_int_rtx
        /export/users/haochenj/src/gcc/master/./gcc/simplify-rtx.cc:57
0x156521c simplify_context::simplify_binary_operation_1(rtx_code, machine_mode,
rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        /export/users/haochenj/src/gcc/master/./gcc/simplify-rtx.cc:3171
0x1562b50 simplify_context::simplify_binary_operation(rtx_code, machine_mode,
rtx_def*, rtx_def*)
        /export/users/haochenj/src/gcc/master/./gcc/simplify-rtx.cc:2641
0xfcbd31 simplify_binary_operation(rtx_code, machine_mode, rtx_def*, rtx_def*)
        /export/users/haochenj/src/gcc/master/./gcc/rtl.h:3485
0x15730be simplify_const_relational_operation(rtx_code, machine_mode, rtx_def*,
rtx_def*)
        /export/users/haochenj/src/gcc/master/./gcc/simplify-rtx.cc:6173
0x1571a01 simplify_context::simplify_relational_operation(rtx_code,
machine_mode, machine_mode, rtx_def*, rtx_def*)
        /export/users/haochenj/src/gcc/master/./gcc/simplify-rtx.cc:5759
0xf0607d simplify_relational_operation(rtx_code, machine_mode, machine_mode,
rtx_def*, rtx_def*)
        /export/users/haochenj/src/gcc/master/./gcc/rtl.h:3500
0x29418dd fold_rtx
        /export/users/haochenj/src/gcc/master/./gcc/cse.cc:3487
0x2940e75 fold_rtx
        /export/users/haochenj/src/gcc/master/./gcc/cse.cc:3227
0x29443e9 cse_insn
        /export/users/haochenj/src/gcc/master/./gcc/cse.cc:4667
0x29498ce cse_extended_basic_block
        /export/users/haochenj/src/gcc/master/./gcc/cse.cc:6566
0x2949ddd cse_main
        /export/users/haochenj/src/gcc/master/./gcc/cse.cc:6711
0x294c0c6 rest_of_handle_cse2
        /export/users/haochenj/src/gcc/master/./gcc/cse.cc:7609

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

* [Bug target/110083] [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1
  2023-06-02  2:23 [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1 haochen.jiang at intel dot com
@ 2023-06-02  2:40 ` pinskia at gcc dot gnu.org
  2023-06-02  9:02 ` roger at nextmovesoftware dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-02  2:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Keywords|                            |ice-on-valid-code

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

* [Bug target/110083] [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1
  2023-06-02  2:23 [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1 haochen.jiang at intel dot com
  2023-06-02  2:40 ` [Bug target/110083] " pinskia at gcc dot gnu.org
@ 2023-06-02  9:02 ` roger at nextmovesoftware dot com
  2023-06-02 11:18 ` roger at nextmovesoftware dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-06-02  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |roger at nextmovesoftware dot com
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-06-02
     Ever confirmed|0                           |1

--- Comment #1 from Roger Sayle <roger at nextmovesoftware dot com> ---
The latent issue exposed by my change is that REG_EQUAL notes on comparisons
are not (correctly) being updated during the STV pass.  The temporary work
around is -mno-stv, but I'm working on a patch so that the TImode
const_wide_int in the REG_EQUAL note is converted into a suitable CONST_VECTOR.

The silver lining is that using CCZmode for ptest is finding more optimization
opportunities than before, so that's a good thing.

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

* [Bug target/110083] [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1
  2023-06-02  2:23 [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1 haochen.jiang at intel dot com
  2023-06-02  2:40 ` [Bug target/110083] " pinskia at gcc dot gnu.org
  2023-06-02  9:02 ` roger at nextmovesoftware dot com
@ 2023-06-02 11:18 ` roger at nextmovesoftware dot com
  2023-06-04 11:01 ` cvs-commit at gcc dot gnu.org
  2023-06-09 17:47 ` roger at nextmovesoftware dot com
  4 siblings, 0 replies; 6+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-06-02 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> ---
Created attachment 55241
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55241&action=edit
proposed patch

This patch fixes the problem.  Bootstrap and regression tests underway.

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

* [Bug target/110083] [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1
  2023-06-02  2:23 [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1 haochen.jiang at intel dot com
                   ` (2 preceding siblings ...)
  2023-06-02 11:18 ` roger at nextmovesoftware dot com
@ 2023-06-04 11:01 ` cvs-commit at gcc dot gnu.org
  2023-06-09 17:47 ` roger at nextmovesoftware dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-04 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:8ab9fb6b8e05cf9acca7bd8282979ede53524cf1

commit r14-1528-g8ab9fb6b8e05cf9acca7bd8282979ede53524cf1
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Sun Jun 4 11:59:32 2023 +0100

    PR target/110083: Fix-up REG_EQUAL notes on COMPARE in STV.

    This patch fixes PR target/110083, an ICE-on-valid regression exposed by
    my recent PTEST improvements (to address PR target/109973).  The latent
    bug (admittedly mine) is that the scalar-to-vector (STV) pass doesn't
update
    or delete REG_EQUAL notes attached to COMPARE instructions.  As a result
    the operands of COMPARE would be mismatched, with the register transformed
    to V1TImode, but the immediate operand left as const_wide_int, which is
    valid for TImode but not V1TImode.  This remained latent when the STV
    conversion converted the mode of the COMPARE to CCmode, with later passes
    recognizing the REG_EQUAL note is obviously invalid as the modes didn't
    match, but now that we (correctly) preserve the CCZmode on COMPARE, the
    mismatched operand modes trigger a sanity checking ICE downstream.

    Fixed by updating (or deleting) any REG_EQUAL notes in convert_compare.

    Before:
        (expr_list:REG_EQUAL (compare:CCZ (reg:V1TI 119 [ ivin.29_38 ])
            (const_wide_int 0x80000000000000000000000000000000))

    After:
        (expr_list:REG_EQUAL (compare:CCZ (reg:V1TI 119 [ ivin.29_38 ])
            (const_vector:V1TI [
                (const_wide_int 0x80000000000000000000000000000000)
             ]))

    2023-06-04  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR target/110083
            * config/i386/i386-features.cc (scalar_chain::convert_compare):
            Update or delete REG_EQUAL notes, converting CONST_INT and
            CONST_WIDE_INT immediate operands to a suitable CONST_VECTOR.

    gcc/testsuite/ChangeLog
            PR target/110083
            * gcc.target/i386/pr110083.c: New test case.

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

* [Bug target/110083] [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1
  2023-06-02  2:23 [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1 haochen.jiang at intel dot com
                   ` (3 preceding siblings ...)
  2023-06-04 11:01 ` cvs-commit at gcc dot gnu.org
@ 2023-06-09 17:47 ` roger at nextmovesoftware dot com
  4 siblings, 0 replies; 6+ messages in thread
From: roger at nextmovesoftware dot com @ 2023-06-09 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

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

--- Comment #4 from Roger Sayle <roger at nextmovesoftware dot com> ---
This is now fixed on mainline.

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

end of thread, other threads:[~2023-06-09 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  2:23 [Bug target/110083] New: [14 Regression] ICEs for testcase on fp-int-convert*timode after r14-1466-g3635e8c67e1 haochen.jiang at intel dot com
2023-06-02  2:40 ` [Bug target/110083] " pinskia at gcc dot gnu.org
2023-06-02  9:02 ` roger at nextmovesoftware dot com
2023-06-02 11:18 ` roger at nextmovesoftware dot com
2023-06-04 11:01 ` cvs-commit at gcc dot gnu.org
2023-06-09 17:47 ` 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).