public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4
@ 2024-03-25 17:18 sjames at gcc dot gnu.org
  2024-03-25 17:20 ` [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4 sjames at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-25 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114471
           Summary: [14 regression] ICE when building liblc3-1.0.4
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 57811
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57811&action=edit
spec.c.i

Initially reported downstream in Gentoo by tdr.

```
$ gcc-14 /tmp/foo.c -c -O2 -fno-vect-cost-model -march=x86-64-v4
/tmp/foo.c: In function ‘quantize’:
/tmp/foo.c:4:6: error: type mismatch in binary expression
    4 | void quantize(int i, short x1) {
      |      ^~~~~~~~
vector(2) <signed-boolean:16>

vector(2) <signed-boolean:16>

vector(2) <signed-boolean:8>

mask_patt_47.14_40 = mask__2.11_44 & mask_patt_48.13_41;
during GIMPLE pass: slp
/tmp/foo.c:4:6: internal compiler error: verify_gimple failed
0x55ab954d6b85 verify_gimple_in_cfg(function*, bool, bool)
       
/usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/tree-cfg.cc:5663
0x55ab96a54818 execute_function_todo
        /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/passes.cc:2088
0x55ab96a54818 do_per_function
        /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/passes.cc:1687
0x55ab96a54818 execute_todo
        /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/gcc/passes.cc:2142
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
@ 2024-03-25 17:20 ` sjames at gcc dot gnu.org
  2024-03-25 17:21 ` sjames at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-25 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
The original failed with:
```
../liblc3-1.0.4/src/spec.c: In function ‘quantize’:
../liblc3-1.0.4/src/spec.c:210:21: error: type mismatch in binary expression
  210 | LC3_HOT static void quantize(enum lc3_dt dt, enum lc3_srate sr,
      |                     ^~~~~~~~
vector(2) <signed-boolean:16>

vector(2) <signed-boolean:16>

vector(2) <signed-boolean:8>

mask_patt_142.112_162 = mask__23.109_158 & mask_patt_141.111_161;
during GIMPLE pass: vect
../liblc3-1.0.4/src/spec.c:210:21: internal compiler error: verify_gimple
failed
0x559439cc2712 verify_gimple_in_cfg(function*, bool, bool)
       
/usr/src/debug/sys-devel/gcc-14.0.1_pre20240324/gcc-14-20240324/gcc/tree-cfg.cc:5663
0x559439ad9a28 execute_function_todo
       
/usr/src/debug/sys-devel/gcc-14.0.1_pre20240324/gcc-14-20240324/gcc/passes.cc:2088
0x559439ad9c8b do_per_function
       
/usr/src/debug/sys-devel/gcc-14.0.1_pre20240324/gcc-14-20240324/gcc/passes.cc:1687
0x559439ad9c8b execute_todo
       
/usr/src/debug/sys-devel/gcc-14.0.1_pre20240324/gcc-14-20240324/gcc/passes.cc:2142
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
ninja: build stopped: subcommand failed.
```

i.e. vect, not slp.

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
  2024-03-25 17:20 ` [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4 sjames at gcc dot gnu.org
@ 2024-03-25 17:21 ` sjames at gcc dot gnu.org
  2024-03-25 18:02 ` sjames at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-25 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 57812
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57812&action=edit
spec.i.orig.xz

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
  2024-03-25 17:20 ` [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4 sjames at gcc dot gnu.org
  2024-03-25 17:21 ` sjames at gcc dot gnu.org
@ 2024-03-25 18:02 ` sjames at gcc dot gnu.org
  2024-03-25 22:51 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-03-25 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
float quantize_x_1, quantize_x_0;
short *quantize_xq;
short quantize_x0;
void quantize() {
  short x1 = quantize_xq[0] =
      quantize_x0 + ((quantize_x0 > 0) & (quantize_x_0 < 0));
  quantize_xq[1] = 1 + ((x1 > 0) & (quantize_x_1 < 0));
}

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-25 18:02 ` sjames at gcc dot gnu.org
@ 2024-03-25 22:51 ` pinskia at gcc dot gnu.org
  2024-03-26  3:58 ` liuhongt at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-25 22:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection
   Last reconfirmed|                            |2024-03-25

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A little cleaned up testcase which might show what can and cannot be SLP'ed:
```
float f1, f0, fa[2];
short sa[2];
void quantize(short s0) {
  _Bool ta[2] = {(fa[0] < 0), (fa[1] < 0)};
  _Bool t = ((s0 > 0) & ta[0]);
  short x1 = s0 + t;
  _Bool t1 = ((x1 > 0) & ta[1]);
  sa[0] = x1;
  sa[1] = s0 + t1;
}
```

Confirmed.

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-25 22:51 ` pinskia at gcc dot gnu.org
@ 2024-03-26  3:58 ` liuhongt at gcc dot gnu.org
  2024-03-26  4:09 ` liuhongt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-03-26  3:58 UTC (permalink / raw)
  To: gcc-bugs

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

Hongtao Liu <liuhongt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liuhongt at gcc dot gnu.org

--- Comment #5 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
Maybe we should always use kmask under AVX512, currently only >= 128-bits
vector of vector _Float16 use kmask, < 128 bits vector still use vector mask.

24628  /* Scalar mask case.  */
24629  if ((TARGET_AVX512F && TARGET_EVEX512 && vector_size == 64)
24630      || (TARGET_AVX512VL && (vector_size == 32 || vector_size == 16))
24631      /* AVX512FP16 only supports vector comparison
24632         to kmask for _Float16.  */
24633      || (TARGET_AVX512VL && TARGET_AVX512FP16
24634          && GET_MODE_INNER (data_mode) == E_HFmode))
24635    {
24636      if (elem_size == 4
24637          || elem_size == 8
24638          || (TARGET_AVX512BW && (elem_size == 1 || elem_size == 2)))
24639        return smallest_int_mode_for_size (nunits);
24640    }
24641
24642  scalar_int_mode elem_mode
24643    = smallest_int_mode_for_size (elem_size * BITS_PER_UNIT);
24644
24645  gcc_assert (elem_size * nunits == vector_size);
24646
24647  return mode_for_vector (elem_mode, nunits);

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-26  3:58 ` liuhongt at gcc dot gnu.org
@ 2024-03-26  4:09 ` liuhongt at gcc dot gnu.org
  2024-03-26  7:58 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-03-26  4:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Hongtao Liu from comment #5)
> Maybe we should always use kmask under AVX512, currently only >= 128-bits
> vector of vector _Float16 use kmask, < 128 bits vector still use vector mask.
> 
and we need to support vec_cmp/vcond_mask for 64/32/16-bit vectors.
For the testcase, there's no kmask used at all, why x86-64-v3 doesn't issue an
error.

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-26  4:09 ` liuhongt at gcc dot gnu.org
@ 2024-03-26  7:58 ` rguenth at gcc dot gnu.org
  2024-03-26 10:06 ` cvs-commit at gcc dot gnu.org
  2024-03-26 10:07 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-26  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-03-26  7:58 ` rguenth at gcc dot gnu.org
@ 2024-03-26 10:06 ` cvs-commit at gcc dot gnu.org
  2024-03-26 10:07 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-26 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from GCC 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:f4e92d62dccb96ade753f3a8f49be1b5f61c31f1

commit r14-9666-gf4e92d62dccb96ade753f3a8f49be1b5f61c31f1
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Mar 26 09:11:00 2024 +0100

    tree-optimization/114471 - ICE with mismatching vector types

    The following fixes too lax verification of vector type compatibility
    in vectorizable_operation.  When we only have a single vector size then
    comparing the number of elements is enough but with SLP we mix those
    and thus for operations like BIT_AND_EXPR we need to verify compatible
    element types as well.  Allow sign changes for ABSU_EXPR though.

            PR tree-optimization/114471
            * tree-vect-stmts.cc (vectorizable_operation): Verify operand
            types are compatible with the result type.

            * gcc.dg/vect/pr114471.c: New testcase.

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

* [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4
  2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-03-26 10:06 ` cvs-commit at gcc dot gnu.org
@ 2024-03-26 10:07 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-26 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed, possibly latent.  Note this didn't fix the vector types chosen (bool
patterns ...) but instead hardens against choices that don't work out.

A missed-optimization bug might be filed (ISTR there are some around bool
patterns already).

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

end of thread, other threads:[~2024-03-26 10:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 17:18 [Bug tree-optimization/114471] New: [14 regression] ICE when building liblc3-1.0.4 sjames at gcc dot gnu.org
2024-03-25 17:20 ` [Bug tree-optimization/114471] [14 regression] ICE when building liblc3-1.0.4 with -fno-vect-cost-model -march=x86-64-v4 sjames at gcc dot gnu.org
2024-03-25 17:21 ` sjames at gcc dot gnu.org
2024-03-25 18:02 ` sjames at gcc dot gnu.org
2024-03-25 22:51 ` pinskia at gcc dot gnu.org
2024-03-26  3:58 ` liuhongt at gcc dot gnu.org
2024-03-26  4:09 ` liuhongt at gcc dot gnu.org
2024-03-26  7:58 ` rguenth at gcc dot gnu.org
2024-03-26 10:06 ` cvs-commit at gcc dot gnu.org
2024-03-26 10:07 ` 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).