public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx
@ 2021-07-02  9:59 zsojka at seznam dot cz
  2021-07-02 10:33 ` [Bug target/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2021-07-02  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101294
           Summary: [12 Regression] ICE: in maybe_legitimize_operand, at
                    optabs.c:7614 with -mavx
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 51101
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51101&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -mavx testcase.c 
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:7:3: internal compiler error: in maybe_legitimize_operand, at
optabs.c:7614
    7 |   __builtin_shufflevector ((U){}, (V){}, 3);
      |   ^~~~~~~~~~~~~~~~~~~~~~~
0x6f80cd maybe_legitimize_operand
        /repo/gcc-trunk/gcc/optabs.c:7614
0x6f80cd maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
        /repo/gcc-trunk/gcc/optabs.c:7751
0xf562c9 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.c:7770
0xf63f68 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.c:7813
0xf63f68 expand_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.c:7844
0xcfc2ab store_constructor
        /repo/gcc-trunk/gcc/expr.c:7086
0xcfd995 expand_constructor
        /repo/gcc-trunk/gcc/expr.c:8563
0xce9e8a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /repo/gcc-trunk/gcc/expr.c:10748
0xcf71cc store_expr(tree_node*, rtx_def*, int, bool, bool)
        /repo/gcc-trunk/gcc/expr.c:5994
0xcf898d expand_assignment(tree_node*, tree_node*, bool)
        /repo/gcc-trunk/gcc/expr.c:5729
0xbb1377 expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.c:3943
0xbb1377 expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.c:4041
0xbb7b8b expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.c:6083
0xbb9ab7 execute
        /repo/gcc-trunk/gcc/cfgexpand.c:6809
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-1975-20210702102426-g496e1d6a1f9-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-1975-20210702102426-g496e1d6a1f9-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210702 (experimental) (GCC)

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

* [Bug target/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
@ 2021-07-02 10:33 ` marxin at gcc dot gnu.org
  2021-07-02 11:13 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-07-02 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
            Summary|[12 Regression] ICE: in     |[12 Regression] ICE: in
                   |maybe_legitimize_operand,   |maybe_legitimize_operand,
                   |at optabs.c:7614 with -mavx |at optabs.c:7614 with -mavx
                   |                            |since
                   |                            |r12-1958-gedafb35bdadf309e
   Last reconfirmed|                            |2021-07-02
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r12-1958-gedafb35bdadf309e.

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

* [Bug target/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
  2021-07-02 10:33 ` [Bug target/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e marxin at gcc dot gnu.org
@ 2021-07-02 11:13 ` rguenth at gcc dot gnu.org
  2021-07-02 13:04 ` [Bug middle-end/101294] " hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-02 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug middle-end/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
  2021-07-02 10:33 ` [Bug target/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e marxin at gcc dot gnu.org
  2021-07-02 11:13 ` rguenth at gcc dot gnu.org
@ 2021-07-02 13:04 ` hjl.tools at gmail dot com
  2021-07-02 14:03 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-02 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |middle-end

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
The bug is latent before r12-1958.  store_constructor has

        /* Try using vec_duplicate_optab for uniform vectors.  */
        if (!TREE_SIDE_EFFECTS (exp) 
            && VECTOR_MODE_P (mode)
            && eltmode == GET_MODE_INNER (mode)
            && ((icode = optab_handler (vec_duplicate_optab, mode))
                != CODE_FOR_nothing)
            && (elt = uniform_vector_p (exp)))
          {
            class expand_operand ops[2];
            create_output_operand (&ops[0], target, mode);
            create_input_operand (&ops[1], expand_normal (elt), eltmode);
            expand_insn (icode, 2, ops); 
            if (!rtx_equal_p (target, ops[0].value))
              emit_move_insn (target, ops[0].value);
            break;
          }

(gdb)  call debug_tree (exp)
 <constructor 0x7fffea23a9a8
    type <vector_type 0x7fffea22ab28
        type <integer_type 0x7fffea0f1930 long long unsigned int public
unsigned DI
            size <integer_cst 0x7fffea0d8cf0 constant 64>
            unit-size <integer_cst 0x7fffea0d8d08 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea0f1930 precision:64 min <integer_cst 0x7fffea0f6018 0> max <integer_cst
0x7fffea0d9540 18446744073709551615>
            pointer_to_this <pointer_type 0x7fffea101348>>
        unsigned V4DI
        size <integer_cst 0x7fffea0f6060 constant 256>
        unit-size <integer_cst 0x7fffea0f6150 constant 32>
        align:256 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea22ab28 nunits:4 context <translation_unit_decl 0x7fffea0e6ac8 x.c>>
    constant length:4
    val <vector_cst 0x7fffea23a8a0
        type <vector_type 0x7fffea22aa80 U type <integer_type 0x7fffea0f1930
long long unsigned int>
            unsigned V1DI size <integer_cst 0x7fffea0d8cf0 64> unit-size
<integer_cst 0x7fffea0d8d08 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea22a9d8 nunits:1 context <translation_unit_decl 0x7fffea0e6ac8 x.c>>
        constant npatterns:1 nelts-per-pattern:1
        elt:0:  <integer_cst 0x7fffea0f6018 constant 0>>
    val <vector_cst 0x7fffea23a900 type <vector_type 0x7fffea22aa80 U>
        constant npatterns:1 nelts-per-pattern:1 elt:0:  <integer_cst
0x7fffea0f6018 0>>
    val <vector_cst 0x7fffea23a900 type <vector_type 0x7fffea22aa80 U>
        constant npatterns:1 nelts-per-pattern:1 elt:0:  <integer_cst
0x7fffea0f6018 0>>
    val <vector_cst 0x7fffea23a900 type <vector_type 0x7fffea22aa80 U>
        constant npatterns:1 nelts-per-pattern:1 elt:0:  <integer_cst
0x7fffea0f6018 0>>>
(gdb)  call debug_tree (elt)
 <vector_cst 0x7fffea23a8a0
    type <vector_type 0x7fffea22aa80 U
        type <integer_type 0x7fffea0f1930 long long unsigned int public
unsigned DI
            size <integer_cst 0x7fffea0d8cf0 constant 64>
            unit-size <integer_cst 0x7fffea0d8d08 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea0f1930 precision:64 min <integer_cst 0x7fffea0f6018 0> max <integer_cst
0x7fffea0d9540 18446744073709551615>
            pointer_to_this <pointer_type 0x7fffea101348>>
        unsigned V1DI size <integer_cst 0x7fffea0d8cf0 64> unit-size
<integer_cst 0x7fffea0d8d08 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea22a9d8 nunits:1 context <translation_unit_decl 0x7fffea0e6ac8 x.c>>
    constant npatterns:1 nelts-per-pattern:1
    elt:0:  <integer_cst 0x7fffea0f6018 type <integer_type 0x7fffea0f1930 long
long unsigned int> constant 0>>
(gdb) p eltmode
$11 = E_DImode
(gdb) 

DImode != V1DImode.

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

* [Bug middle-end/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2021-07-02 13:04 ` [Bug middle-end/101294] " hjl.tools at gmail dot com
@ 2021-07-02 14:03 ` hjl.tools at gmail dot com
  2021-07-02 15:14 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-02 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
This works:

diff --git a/gcc/expr.c b/gcc/expr.c
index 025033c9ecf..bd85bbfdd6f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7078,7 +7078,8 @@ store_constructor (tree exp, rtx target, int cleared,
poly_int64 size,
       && eltmode == GET_MODE_INNER (mode)
       && ((icode = optab_handler (vec_duplicate_optab, mode))
      != CODE_FOR_nothing)
-      && (elt = uniform_vector_p (exp)))
+      && (elt = uniform_vector_p (exp))
+      && !VECTOR_TYPE_P (TREE_TYPE (elt)))
     {
       class expand_operand ops[2];
       create_output_operand (&ops[0], target, mode);

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

* [Bug middle-end/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2021-07-02 14:03 ` hjl.tools at gmail dot com
@ 2021-07-02 15:14 ` rguenther at suse dot de
  2021-07-03 11:40 ` cvs-commit at gcc dot gnu.org
  2021-07-03 11:41 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: rguenther at suse dot de @ 2021-07-02 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On July 2, 2021 4:03:34 PM GMT+02:00, "hjl.tools at gmail dot com"
<gcc-bugzilla@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101294
>
>--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
>This works:
>
>diff --git a/gcc/expr.c b/gcc/expr.c
>index 025033c9ecf..bd85bbfdd6f 100644
>--- a/gcc/expr.c
>+++ b/gcc/expr.c
>@@ -7078,7 +7078,8 @@ store_constructor (tree exp, rtx target, int
>cleared,
>poly_int64 size,
>       && eltmode == GET_MODE_INNER (mode)
>       && ((icode = optab_handler (vec_duplicate_optab, mode))
>      != CODE_FOR_nothing)
>-      && (elt = uniform_vector_p (exp)))
>+      && (elt = uniform_vector_p (exp))
>+      && !VECTOR_TYPE_P (TREE_TYPE (elt)))
>     {
>       class expand_operand ops[2];
>       create_output_operand (&ops[0], target, mode);

I guess that's reasonable.

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

* [Bug middle-end/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2021-07-02 15:14 ` rguenther at suse dot de
@ 2021-07-03 11:40 ` cvs-commit at gcc dot gnu.org
  2021-07-03 11:41 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-03 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:52c3fdf3e4780f75297515d3c2a3dae9b36586ba

commit r12-1996-g52c3fdf3e4780f75297515d3c2a3dae9b36586ba
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jul 2 10:03:48 2021 -0700

    Don't use vec_duplicate on vector in CTOR expansion

    Since vec_duplicate only works on scalar, don't use it on vector in
    store constructor expansion.

    gcc/

            PR middle-end/101294
            * expr.c (store_constructor): Don't use vec_duplicate on vector.

    gcc/testsuite/

            PR middle-end/101294
            * gcc.dg/pr101294.c: New test.

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

* [Bug middle-end/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e
  2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2021-07-03 11:40 ` cvs-commit at gcc dot gnu.org
@ 2021-07-03 11:41 ` hjl.tools at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-03 11:41 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

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

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

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

end of thread, other threads:[~2021-07-03 11:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02  9:59 [Bug target/101294] New: [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx zsojka at seznam dot cz
2021-07-02 10:33 ` [Bug target/101294] [12 Regression] ICE: in maybe_legitimize_operand, at optabs.c:7614 with -mavx since r12-1958-gedafb35bdadf309e marxin at gcc dot gnu.org
2021-07-02 11:13 ` rguenth at gcc dot gnu.org
2021-07-02 13:04 ` [Bug middle-end/101294] " hjl.tools at gmail dot com
2021-07-02 14:03 ` hjl.tools at gmail dot com
2021-07-02 15:14 ` rguenther at suse dot de
2021-07-03 11:40 ` cvs-commit at gcc dot gnu.org
2021-07-03 11:41 ` hjl.tools at gmail 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).