public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835
@ 2021-10-03  3:39 vsevolod.livinskij at frtk dot ru
  2021-10-03  6:24 ` [Bug tree-optimization/102572] [11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vsevolod.livinskij at frtk dot ru @ 2021-10-03  3:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102572
           Summary: ICE for skx in vect_build_gather_load_calls, at
                    tree-vect-stmts.c:2835
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskij at frtk dot ru
  Target Milestone: ---

Reproducer:
int a, b, c, f;
void g(bool h, int d[][5]) {
  for (short i = f; i; i += 1) {
    a = h && d[0][i];
    for (int j = 0; j < 4; j += c)
      b = 0;
  }
}

Error:

>$ g++ -O3 -march=skylake-avx512 -c func.cpp
during GIMPLE pass: vect
func.cpp: In function 'void g(bool, int (*)[5])':
func.cpp:2:6: internal compiler error: in vect_build_gather_load_calls, at
tree-vect-stmts.c:2835
    2 | void g(bool h, int d[][5]) {
      |      ^
0x906a36 vect_build_gather_load_calls
        /testing/gcc/gcc_src/gcc/tree-vect-stmts.c:2835
0x906a36 vectorizable_load
        /testing/gcc/gcc_src/gcc/tree-vect-stmts.c:8785
0x1500240 vect_transform_stmt(vec_info*, _stmt_vec_info*,
gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
        /testing/gcc/gcc_src/gcc/tree-vect-stmts.c:11060
0x1503e6a vect_transform_loop_stmt
        /testing/gcc/gcc_src/gcc/tree-vect-loop.c:9362
0x151fd67 vect_transform_loop(_loop_vec_info*, gimple*)
        /testing/gcc/gcc_src/gcc/tree-vect-loop.c:9798
0x1553a8f try_vectorize_loop_1
        /testing/gcc/gcc_src/gcc/tree-vectorizer.c:1109
0x1554591 vectorize_loops()
        /testing/gcc/gcc_src/gcc/tree-vectorizer.c:1248

GCC version:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/testing/gcc/bin/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /testing/gcc/gcc_src/configure --enable-multilib
--prefix=/testing/gcc/bin --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211002 (d7705b0ada9e9852b580ca25a45570c82152f287) (GCC)

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

* [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
@ 2021-10-03  6:24 ` pinskia at gcc dot gnu.org
  2021-10-03  6:26 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-03  6:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-10-03
     Ever confirmed|0                           |1
      Known to fail|                            |11.1.0, 11.2.0
      Known to work|                            |10.3.0
   Target Milestone|---                         |11.3
            Summary|ICE for skx in              |[11/12 Regression] ICE for
                   |vect_build_gather_load_call |skx in
                   |s, at                       |vect_build_gather_load_call
                   |tree-vect-stmts.c:2835      |s, at
                   |                            |tree-vect-stmts.c:2835
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
  2021-10-03  6:24 ` [Bug tree-optimization/102572] [11/12 Regression] " pinskia at gcc dot gnu.org
@ 2021-10-03  6:26 ` pinskia at gcc dot gnu.org
  2021-10-04  7:14 ` [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019 marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-03  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
              if (!useless_type_conversion_p (masktype, TREE_TYPE (vec_mask)))
                {
                  poly_uint64 sub1 = TYPE_VECTOR_SUBPARTS (TREE_TYPE
(mask_op));
                  poly_uint64 sub2 = TYPE_VECTOR_SUBPARTS (masktype);
                  gcc_assert (known_eq (sub1, sub2));

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

* [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
  2021-10-03  6:24 ` [Bug tree-optimization/102572] [11/12 Regression] " pinskia at gcc dot gnu.org
  2021-10-03  6:26 ` pinskia at gcc dot gnu.org
@ 2021-10-04  7:14 ` marxin at gcc dot gnu.org
  2021-10-04  7:16 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-04  7:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
            Summary|[11/12 Regression] ICE for  |[11/12 Regression] ICE for
                   |skx in                      |skx in
                   |vect_build_gather_load_call |vect_build_gather_load_call
                   |s, at                       |s, at
                   |tree-vect-stmts.c:2835      |tree-vect-stmts.c:2835
                   |                            |since
                   |                            |r11-3070-g783dc66f9ccb0019

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-3070-g783dc66f9ccb0019.

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

* [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
                   ` (2 preceding siblings ...)
  2021-10-04  7:14 ` [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019 marxin at gcc dot gnu.org
@ 2021-10-04  7:16 ` rguenth at gcc dot gnu.org
  2021-10-12 11:39 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-04  7:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I can take a look.

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

* [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
                   ` (3 preceding siblings ...)
  2021-10-04  7:16 ` rguenth at gcc dot gnu.org
@ 2021-10-12 11:39 ` rguenth at gcc dot gnu.org
  2021-10-12 12:50 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-12 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
The to be vectorized IL is

  <bb 4> [local count: 118111600]:
  # i_21 = PHI <i_18(12), i_14(27)>
  _2 = (int) i_21;
  _32 = &(*d_16(D))[_2];
  _3 = .MASK_LOAD (_32, 32B, h_15(D));
  _5 = _3 != 0;
  _23 = _5 & h_15(D);
  prephitmp_36 = _23 ? 1 : 0;
  i.3_6 = (unsigned short) i_21;
  _7 = i.3_6 + 1;
  i_18 = (short int) _7;
  if (i_18 != 0)
    goto <bb 12>; [89.00%]
  else
    goto <bb 10>; [11.00%]

  <bb 12> [local count: 105119324]:
  goto <bb 4>; [100.00%]

and the issue is that the mask is an invariant but we're just using
vect_get_vec_defs_for_operand and that does

  if (dt == vect_constant_def || dt == vect_external_def)
    {
      tree stmt_vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
      tree vector_type;

      if (vectype)
        vector_type = vectype;
      else if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op))
               && VECTOR_BOOLEAN_TYPE_P (stmt_vectype))
        vector_type = truth_type_for (stmt_vectype);

but of course stmt_vectype is not a boolean type but V8SI.

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

* [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
                   ` (4 preceding siblings ...)
  2021-10-12 11:39 ` rguenth at gcc dot gnu.org
@ 2021-10-12 12:50 ` cvs-commit at gcc dot gnu.org
  2021-10-12 12:50 ` [Bug tree-optimization/102572] [11 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-12 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:9f12a45ef147e563f099c24c293830727e8204cc

commit r12-4350-g9f12a45ef147e563f099c24c293830727e8204cc
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Oct 12 13:42:08 2021 +0200

    tree-optimization/102572 - fix gathers with invariant mask

    This fixes the vector def gathering for invariant masks which
    failed to pass in the desired vector type resulting in a non-mask
    type to be generate.

    2021-10-12  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/102572
            * tree-vect-stmts.c (vect_build_gather_load_calls): When
            gathering the vectorized defs for the mask pass in the
            desired mask vector type so invariants will be handled
            correctly.

            * g++.dg/vect/pr102572.cc: New testcase.

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

* [Bug tree-optimization/102572] [11 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
                   ` (5 preceding siblings ...)
  2021-10-12 12:50 ` cvs-commit at gcc dot gnu.org
@ 2021-10-12 12:50 ` rguenth at gcc dot gnu.org
  2021-11-08 12:35 ` cvs-commit at gcc dot gnu.org
  2021-11-08 12:37 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-12 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.0
            Summary|[11/12 Regression] ICE for  |[11 Regression] ICE for skx
                   |skx in                      |in
                   |vect_build_gather_load_call |vect_build_gather_load_call
                   |s, at                       |s, at
                   |tree-vect-stmts.c:2835      |tree-vect-stmts.c:2835
                   |since                       |since
                   |r11-3070-g783dc66f9ccb0019  |r11-3070-g783dc66f9ccb0019

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/102572] [11 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
                   ` (6 preceding siblings ...)
  2021-10-12 12:50 ` [Bug tree-optimization/102572] [11 " rguenth at gcc dot gnu.org
@ 2021-11-08 12:35 ` cvs-commit at gcc dot gnu.org
  2021-11-08 12:37 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-08 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:092e98d94080ca253dc4ef6957d6efaeccb88df6

commit r11-9225-g092e98d94080ca253dc4ef6957d6efaeccb88df6
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Oct 12 13:42:08 2021 +0200

    tree-optimization/102572 - fix gathers with invariant mask

    This fixes the vector def gathering for invariant masks which
    failed to pass in the desired vector type resulting in a non-mask
    type to be generate.

    2021-10-12  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/102572
            * tree-vect-stmts.c (vect_build_gather_load_calls): When
            gathering the vectorized defs for the mask pass in the
            desired mask vector type so invariants will be handled
            correctly.

            * g++.dg/vect/pr102572.cc: New testcase.

    (cherry picked from commit 9f12a45ef147e563f099c24c293830727e8204cc)

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

* [Bug tree-optimization/102572] [11 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019
  2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
                   ` (7 preceding siblings ...)
  2021-11-08 12:35 ` cvs-commit at gcc dot gnu.org
@ 2021-11-08 12:37 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-08 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.2.1
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-11-08 12:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03  3:39 [Bug tree-optimization/102572] New: ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 vsevolod.livinskij at frtk dot ru
2021-10-03  6:24 ` [Bug tree-optimization/102572] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-10-03  6:26 ` pinskia at gcc dot gnu.org
2021-10-04  7:14 ` [Bug tree-optimization/102572] [11/12 Regression] ICE for skx in vect_build_gather_load_calls, at tree-vect-stmts.c:2835 since r11-3070-g783dc66f9ccb0019 marxin at gcc dot gnu.org
2021-10-04  7:16 ` rguenth at gcc dot gnu.org
2021-10-12 11:39 ` rguenth at gcc dot gnu.org
2021-10-12 12:50 ` cvs-commit at gcc dot gnu.org
2021-10-12 12:50 ` [Bug tree-optimization/102572] [11 " rguenth at gcc dot gnu.org
2021-11-08 12:35 ` cvs-commit at gcc dot gnu.org
2021-11-08 12:37 ` rguenth 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).