public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
@ 2021-07-27  9:15 asolokha at gmx dot com
  2021-07-27 11:30 ` [Bug tree-optimization/101636] " rguenth at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: asolokha at gmx dot com @ 2021-07-27  9:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101636
           Summary: [11/12 Regression] ICE: verify_gimple failed (error:
                    conversion of register to a different size in
                    'view_convert_expr')
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

gcc-12.0.0-alpha20210725 snapshot (g:b454c40956947938c9e274d75cef8a43171f3efa)
ICEs when compiling the following testcase, reduced from
gcc/testsuite/gcc.dg/vect/slp-cond-5.c, w/ -mavx512f -O1 -ftree-vectorize:

inline int
foo (int y, int a)
{
  return (y && a) ? a : 0;
}

void
bar (int *__restrict a, int *__restrict d, int *__restrict e, int i)
{
  while (i < 1)
    {
      e[8] = e[7] = e[6] = e[5] = e[4] = e[3] = e[2] = e[1] = e[0]
        = foo (d[8], a[8]);
      e[9] = foo (d[9], a[9]);
      e[10] = foo (d[0], a[0]);
      e[11] = foo (d[1], a[1]);
      e[12] = foo (d[12], a[12]);
      e[13] = foo (d[13], a[13]);
      e[14] = foo (d[4], a[4]);
      e[15] = foo (d[15], a[15]);

      a += 16;
      e += 1;
      i += 1;
    }
}

% x86_64-pc-linux-gnu-gcc-12.0.0 -mavx512f -O1 -ftree-vectorize -c uo7arifc.c
uo7arifc.c: In function 'bar':
uo7arifc.c:8:1: error: conversion of register to a different size in
'view_convert_expr'
    8 | bar (int *__restrict a, int *__restrict d, int *__restrict e, int i)
      | ^~~
VIEW_CONVERT_EXPR<vector(16) <signed-boolean:1>>(vect_patt_173.38_215);

_151 = VIEW_CONVERT_EXPR<vector(16) <signed-boolean:1>>(vect_patt_173.38_215);
during GIMPLE pass: slp
uo7arifc.c:8:1: internal compiler error: verify_gimple failed
0xe8a12a verify_gimple_in_cfg(function*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210725/work/gcc-12-20210725/gcc/tree-cfg.c:5536
0xd5934f execute_function_todo
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210725/work/gcc-12-20210725/gcc/passes.c:2042
0xd59d5b execute_todo
       
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210725/work/gcc-12-20210725/gcc/passes.c:2096

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
@ 2021-07-27 11:30 ` rguenth at gcc dot gnu.org
  2021-07-28  7:07 ` rguenth at gcc dot gnu.org
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-27 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-07-27
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |11.2
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

vect_patt_173.38_215 = VEC_COND_EXPR <mask_patt_172.36_214, { -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0 }

t.c:8:1: note: ------>vectorizing SLP node starting from: patt_173 = patt_172 ?
-1 : 0;
t.c:8:1: note: vect_is_simple_use: operand (<signed-boolean:8>) _75, type of
def: internal
t.c:8:1: note: add new stmt: vect_patt_173.38_215 = VEC_COND_EXPR
<mask_patt_172.36_214, { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }>;
t.c:8:1: note: vectorizing stmts using SLP.

I will eventually have a look.

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
  2021-07-27 11:30 ` [Bug tree-optimization/101636] " rguenth at gcc dot gnu.org
@ 2021-07-28  7:07 ` rguenth at gcc dot gnu.org
  2021-08-03 12:42 ` marxin at gcc dot gnu.org
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
  2021-07-27 11:30 ` [Bug tree-optimization/101636] " rguenth at gcc dot gnu.org
  2021-07-28  7:07 ` rguenth at gcc dot gnu.org
@ 2021-08-03 12:42 ` marxin at gcc dot gnu.org
  2021-08-03 13:06 ` rguenther at suse dot de
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-03 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. started with r11-1803-g9bc2c2347d5d782c.

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2021-08-03 12:42 ` marxin at gcc dot gnu.org
@ 2021-08-03 13:06 ` rguenther at suse dot de
  2021-08-03 13:47 ` marxin at gcc dot gnu.org
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenther at suse dot de @ 2021-08-03 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 3 Aug 2021, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101636
> 
> Martin Liška <marxin at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |marxin at gcc dot gnu.org
> 
> --- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
> Btw. started with r11-1803-g9bc2c2347d5d782c.

Please bisect with -fno-vect-cost-model then

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2021-08-03 13:06 ` rguenther at suse dot de
@ 2021-08-03 13:47 ` marxin at gcc dot gnu.org
  2021-08-06  9:58 ` rguenth at gcc dot gnu.org
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-03 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
> Please bisect with -fno-vect-cost-model then

Doing that, it starts with r11-1450-g8a9e230f41eb4063.

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2021-08-03 13:47 ` marxin at gcc dot gnu.org
@ 2021-08-06  9:58 ` rguenth at gcc dot gnu.org
  2021-11-08 11:27 ` rguenth at gcc dot gnu.org
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-06  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So what happens is that we have a vector(16) <signed-boolean:1> constructor

  _151 = {_150, _149, _148, _147, _146, _145, _144, _143, _142, _141, _140,
_139, _138, _137, _136, _135};

fed by a series of

  _150 = _75 ? -1 : 0;

stmts that compute a <signed-boolean:1> from a _Bool.  We're now trying
to vectorize that CTOR (I think that's good).  Now, bool pattern detection
doesn't consider a vector CTOR of <signed-boolean:1> to be a mask precision
"sink" which means we end up with

t.i:26:1: note:   using boolean precision 32 for _49 = _17 != 0;
t.i:26:1: note:   using boolean precision 32 for _74 = _1 != 0;
t.i:26:1: note:   using boolean precision 32 for _75 = _73 & _74;
t.i:26:1: note:   using boolean precision 32 for _70 = _4 != 0;
t.i:26:1: note:   using boolean precision 32 for _71 = _69 & _70;
...

because eventually the compares are 'int' loads.

Now, there's of course the issue that the vectorizer produces this inefficient
code because of similar issues when analyzing the following if-conversion
result
in BB vect mode from the loop vectorizer:

  _16 = MEM[(int *)a_81 + 60B];
  _47 = _16 != 0;
  _45 = _47 & _49;
  iftmp.0_43 = _45 ? _16 : 0;
  MEM[(int *)e_82 + 60B] = iftmp.0_43;

here we end up with the same precisions.  I'm actually unsure how
things should go here, vect_recog_bool_pattern seems to look at
COND_EXPR conditions, but then it does

  else if (rhs_code == COND_EXPR
           && TREE_CODE (var) == SSA_NAME)
    {
      vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
      if (vectype == NULL_TREE)
        return NULL;

      /* Build a scalar type for the boolean result that when
         vectorized matches the vector type of the result in
         size and number of elements.  */
      unsigned prec
        = vector_element_size (tree_to_poly_uint64 (TYPE_SIZE (vectype)),
                               TYPE_VECTOR_SUBPARTS (vectype));

      tree type
        = build_nonstandard_integer_type (prec,
                                          TYPE_UNSIGNED (TREE_TYPE (var)));
      if (get_vectype_for_scalar_type (vinfo, type) == NULL_TREE)
        return NULL;

      if (!check_bool_pattern (var, vinfo, bool_stmts))
        return NULL;

going the classic way of using a non-mask type.  For the testcase
in question check_bool_pattern fails though.

But we fail in vectorizable_operation because for a MASK and we run into

  /* Worthwhile without SIMD support?  Check only during analysis.  */
  if (!VECTOR_MODE_P (vec_mode)
      && !vec_stmt
      && !vect_worthwhile_without_simd_p (vinfo, code))
    {
      if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                         "not worthwhile without SIMD support.\n");
      return false;
    }

that looks like an inefficiency (only triggering for low tripcount loops).
Also vect_worthwhile_without_simd_p looks at the VF only which is insufficient
for SLP.  Even with that fixed the BB vectorization triggered from loop
vect does not see the invariant compared defs of one arm of the bit-and
so we just create another vector CTOR with <signed-boolean:1> and we
repeat the same mistakes.

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2021-08-06  9:58 ` rguenth at gcc dot gnu.org
@ 2021-11-08 11:27 ` rguenth at gcc dot gnu.org
  2021-11-08 11:43 ` marxin at gcc dot gnu.org
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-08 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
           Keywords|                            |needs-bisection

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, it no longer fails, also not when reverting g:eb032893675afea4b0

I can still reproduce it on the GCC 11 branch, what fixed it on trunk?

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2021-11-08 11:27 ` rguenth at gcc dot gnu.org
@ 2021-11-08 11:43 ` marxin at gcc dot gnu.org
  2021-11-08 11:44 ` marxin at gcc dot gnu.org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-08 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
I can still reproduce it with the current master
(g:b7cd3946062e034bcc644db2569cd750041a2ee3):

$ gcc pr101636.c -c -mavx512f -O1 -ftree-vectorize -fno-vect-cost-model
pr101636.c: In function ‘bar’:
pr101636.c:8:1: error: conversion of register to a different size in
‘view_convert_expr’
    8 | bar (int *__restrict a, int *__restrict d, int *__restrict e, int i)
      | ^~~
VIEW_CONVERT_EXPR<vector(16) <signed-boolean:1>>(vect_patt_38.28_172);

_151 = VIEW_CONVERT_EXPR<vector(16) <signed-boolean:1>>(vect_patt_38.28_172);
during GIMPLE pass: slp
pr101636.c:8:1: internal compiler error: verify_gimple failed
0xf60445 verify_gimple_in_cfg(function*, bool)
        /home/marxin/Programming/gcc/gcc/tree-cfg.c:5577
0xe20c6e execute_function_todo
        /home/marxin/Programming/gcc/gcc/passes.c:2042
0xe2125b execute_todo
        /home/marxin/Programming/gcc/gcc/passes.c:2096
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.

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2021-11-08 11:43 ` marxin at gcc dot gnu.org
@ 2021-11-08 11:44 ` marxin at gcc dot gnu.org
  2021-11-08 12:56 ` rguenther at suse dot de
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-08 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
Valgrind reports:

==9236== Conditional jump or move depends on uninitialised value(s)
==9236==    at 0xA3EC2C: bitmap_clear_bit (sbitmap.h:153)
==9236==    by 0xA3EC2C: verify_loop_structure() (cfgloop.c:1579)
==9236==    by 0xD3FAC4: checking_verify_loop_structure (cfgloop.h:646)
==9236==    by 0xD3FAC4: loop_optimizer_init(unsigned int) (loop-init.c:130)
==9236==    by 0xE4E9D7: execute (predict.c:4094)
==9236==    by 0xE4E9D7: (anonymous
namespace)::pass_profile::execute(function*) (predict.c:4087)
==9236==    by 0xE23EF9: execute_one_pass(opt_pass*) (passes.c:2567)
==9236==    by 0xE247F2: execute_pass_list_1(opt_pass*) (passes.c:2656)
==9236==    by 0xE24804: execute_pass_list_1(opt_pass*) (passes.c:2657)
==9236==    by 0xE24835: execute_pass_list(function*, opt_pass*)
(passes.c:2667)
==9236==    by 0xE25258: do_per_function_toporder (passes.c:1773)
==9236==    by 0xE25258: do_per_function_toporder(void (*)(function*, void*),
void*) (passes.c:1736)
==9236==    by 0xE25404: execute_ipa_pass_list(opt_pass*) (passes.c:3001)
==9236==    by 0xA720D8: ipa_passes (cgraphunit.c:2154)
==9236==    by 0xA720D8: compile (cgraphunit.c:2289)
==9236==    by 0xA720D8: symbol_table::compile() (cgraphunit.c:2267)
==9236==    by 0xA74C27: symbol_table::finalize_compilation_unit()
(cgraphunit.c:2537)
==9236==    by 0xF1354C: compile_file() (toplev.c:477)

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (8 preceding siblings ...)
  2021-11-08 11:44 ` marxin at gcc dot gnu.org
@ 2021-11-08 12:56 ` rguenther at suse dot de
  2021-11-08 15:33 ` marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenther at suse dot de @ 2021-11-08 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 8 Nov 2021, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101636
> 
> --- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
> Valgrind reports:
> 
> ==9236== Conditional jump or move depends on uninitialised value(s)
> ==9236==    at 0xA3EC2C: bitmap_clear_bit (sbitmap.h:153)
> ==9236==    by 0xA3EC2C: verify_loop_structure() (cfgloop.c:1579)
> ==9236==    by 0xD3FAC4: checking_verify_loop_structure (cfgloop.h:646)
> ==9236==    by 0xD3FAC4: loop_optimizer_init(unsigned int) (loop-init.c:130)
> ==9236==    by 0xE4E9D7: execute (predict.c:4094)
> ==9236==    by 0xE4E9D7: (anonymous
> namespace)::pass_profile::execute(function*) (predict.c:4087)
> ==9236==    by 0xE23EF9: execute_one_pass(opt_pass*) (passes.c:2567)
> ==9236==    by 0xE247F2: execute_pass_list_1(opt_pass*) (passes.c:2656)
> ==9236==    by 0xE24804: execute_pass_list_1(opt_pass*) (passes.c:2657)
> ==9236==    by 0xE24835: execute_pass_list(function*, opt_pass*)
> (passes.c:2667)
> ==9236==    by 0xE25258: do_per_function_toporder (passes.c:1773)
> ==9236==    by 0xE25258: do_per_function_toporder(void (*)(function*, void*),
> void*) (passes.c:1736)
> ==9236==    by 0xE25404: execute_ipa_pass_list(opt_pass*) (passes.c:3001)
> ==9236==    by 0xA720D8: ipa_passes (cgraphunit.c:2154)
> ==9236==    by 0xA720D8: compile (cgraphunit.c:2289)
> ==9236==    by 0xA720D8: symbol_table::compile() (cgraphunit.c:2267)
> ==9236==    by 0xA74C27: symbol_table::finalize_compilation_unit()
> (cgraphunit.c:2537)
> ==9236==    by 0xF1354C: compile_file() (toplev.c:477)

I'm going to fix that (but it's spurious)

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (9 preceding siblings ...)
  2021-11-08 12:56 ` rguenther at suse dot de
@ 2021-11-08 15:33 ` marxin at gcc dot gnu.org
  2021-11-08 15:33 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-08 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
> I'm going to fix that (but it's spurious)

Now as you fixed the valgrind error, I can still see the original verification
error. What about you?

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (10 preceding siblings ...)
  2021-11-08 15:33 ` marxin at gcc dot gnu.org
@ 2021-11-08 15:33 ` marxin at gcc dot gnu.org
  2021-11-09  7:24 ` rguenther at suse dot de
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-08 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Martin Liška <marxin at gcc dot gnu.org> ---
https://godbolt.org/z/n1sjM6TEY

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (11 preceding siblings ...)
  2021-11-08 15:33 ` marxin at gcc dot gnu.org
@ 2021-11-09  7:24 ` rguenther at suse dot de
  2022-02-22 14:52 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenther at suse dot de @ 2021-11-09  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 8 Nov 2021, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101636
> 
> --- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
> > I'm going to fix that (but it's spurious)
> 
> Now as you fixed the valgrind error, I can still see the original verification
> error. What about you?

Yes, I missed -fno-vect-cost-model in my attempt to reproduce

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (12 preceding siblings ...)
  2021-11-09  7:24 ` rguenther at suse dot de
@ 2022-02-22 14:52 ` rguenth at gcc dot gnu.org
  2022-02-23  9:21 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-22 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 52492
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52492&action=edit
GIMPLE testcase

So I think that the IL we produce from SLP vectorizing the if-converted loop
body is not great and we should address this issue there.  In particular
emitting a
VECTOR_BOOLEAN_TYPE_P CTOR for the external bools is not OK which is also what
the iffy code in vect_create_constant_vectors shows.  A non-loop GIMPLE
testcase
for this is attached.

It doesn't ICE but the code generated is just awful.

I've tried to compensate in vect_create_constant_vectors itself by creating
a non-VECTOR_BOOLEAN_TYPE_P CTOR and producing a VECTOR_BOOLEAN_TYPE_P via
a NE comparison but with just AVX512F we can handle V16SImode compares but
not V16QImode which is what would naturally appear - and vector lowering will
decompose that again and we have no means of failing vectorization in this
function.

Instead I think this needs to be handled by patterns and if it is not,
rejected.  In this case it's vectorizable_operation for bitwise ops
that just picks the result vector type here

  /* If op0 is an external or constant def, infer the vector type
     from the scalar type.  */
  if (!vectype)
    {
      /* For boolean type we cannot determine vectype by
         invariant value (don't know whether it is a vector
         of booleans or vector of integers).  We use output
         vectype because operations on boolean don't change
         type.  */
      if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op0)))
        {
          if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (scalar_dest)))
            {
              if (dump_enabled_p ())
                dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                                 "not supported operation on bool value.\n");
              return false;
            }
          vectype = vectype_out;
        }

but that assumes we can create a vector bool from invariants or externals
which we generally cannot.  If we disable that here we'll run into the
same issue for the COND_EXPR.

Looking at vect_recog_bool_pattern it really does two things at the same time,
optimize |& sequences _and_ perform correctness transforms based on mask
uses.  In this case we only start from the COND_EXPR as a mask use but
once we see the internal-def & external-def mask def we decide we do not
want to optimize it.  But we'd still need to make the external def suitable
for the mask use (and we know the precision to use there).

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (13 preceding siblings ...)
  2022-02-22 14:52 ` rguenth at gcc dot gnu.org
@ 2022-02-23  9:21 ` rguenth at gcc dot gnu.org
  2022-02-23 11:14 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-23  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 52496
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52496&action=edit
GIMPLE testcase for the ICE

This is a GIMPLE testcase for the ICE:

> ./cc1 -quiet t2.c -O -fgimple -mavx512f -ftree-vectorize -fno-vect-cost-model
t2.c: In function 'bar':
t2.c:7:1: error: conversion of register to a different size in
'view_convert_expr'
    7 | bar (int * restrict a, int * restrict d, int * restrict e)
      | ^~~
VIEW_CONVERT_EXPR<vector(16) <signed-boolean:1>>(vect_patt_36.13_6);

_151 = VIEW_CONVERT_EXPR<vector(16) <signed-boolean:1>>(vect_patt_36.13_6);
during GIMPLE pass: slp

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

* [Bug tree-optimization/101636] [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (14 preceding siblings ...)
  2022-02-23  9:21 ` rguenth at gcc dot gnu.org
@ 2022-02-23 11:14 ` cvs-commit at gcc dot gnu.org
  2022-02-23 11:15 ` [Bug tree-optimization/101636] [11 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-23 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 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:6e80c4f1ad9046b0a7c105660cc7b3dcae0fdb8f

commit r12-7359-g6e80c4f1ad9046b0a7c105660cc7b3dcae0fdb8f
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Feb 23 11:15:38 2022 +0100

    tree-optimization/101636 - CTOR vectorization ICE

    The following fixes an ICE when vectorizing the defs of a CTOR
    results in a different vector type than expected.  That can happen
    with AARCH64 SVE and a fixed vector length as noted in r10-5979
    and on x86 with AVX512 mask CTORs and trying to re-vectorize
    using SSE as shown in this bug.

    The fix is simply to reject the vectorization when it didn't
    produce the desired type.

    2022-02-23  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/101636
            * tree-vect-slp.cc (vect_print_slp_tree): Dump the
            vector type of the node.
            (vect_slp_analyze_operations): Make sure the CTOR
            is vectorized with an expected type.
            (vectorize_slp_instance_root_stmt): Revert r10-5979 fix.

            * gcc.target/i386/pr101636.c: New testcase.
            * c-c++-common/torture/pr101636.c: Likewise.

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

* [Bug tree-optimization/101636] [11 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (15 preceding siblings ...)
  2022-02-23 11:14 ` cvs-commit at gcc dot gnu.org
@ 2022-02-23 11:15 ` rguenth at gcc dot gnu.org
  2022-03-07 11:34 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-23 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] ICE:     |[11 Regression] ICE:
                   |verify_gimple failed        |verify_gimple failed
                   |(error: conversion of       |(error: conversion of
                   |register to a different     |register to a different
                   |size in                     |size in
                   |'view_convert_expr')        |'view_convert_expr')
      Known to work|                            |12.0

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.  I split out all optimality considerations to PR104658.

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

* [Bug tree-optimization/101636] [11 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (16 preceding siblings ...)
  2022-02-23 11:15 ` [Bug tree-optimization/101636] [11 " rguenth at gcc dot gnu.org
@ 2022-03-07 11:34 ` rguenth at gcc dot gnu.org
  2022-03-23 14:08 ` cvs-commit at gcc dot gnu.org
  2022-03-23 14:08 ` rguenth at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-07 11:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101636
Bug 101636 depends on bug 104782, which changed state.

Bug 104782 Summary: [12 regression] ICE: verify_gimple failed in slp (non-trivial conversion in ‘ssa_name’) with -msve-vector-bits=128 since r12-7359-g6e80c4f1ad9046b0a7c105660cc7b3dcae0fdb8f
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104782

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

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

* [Bug tree-optimization/101636] [11 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (17 preceding siblings ...)
  2022-03-07 11:34 ` rguenth at gcc dot gnu.org
@ 2022-03-23 14:08 ` cvs-commit at gcc dot gnu.org
  2022-03-23 14:08 ` rguenth at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-23 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 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:893cb28a22f86281ca9ce1e045da7b8840ceb121

commit r11-9689-g893cb28a22f86281ca9ce1e045da7b8840ceb121
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Feb 23 11:15:38 2022 +0100

    tree-optimization/101636 - CTOR vectorization ICE

    The following fixes an ICE when vectorizing the defs of a CTOR
    results in a different vector type than expected.  That can happen
    with AARCH64 SVE and a fixed vector length as noted in r10-5979
    and on x86 with AVX512 mask CTORs and trying to re-vectorize
    using SSE as shown in this bug.

    The fix is simply to reject the vectorization when it didn't
    produce the desired type.

    2022-02-23  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/101636
            PR tree-optimization/104782
            * tree-vect-slp.c (vect_slp_analyze_operations): Make sure
            the CTOR is vectorized with an expected type.

            * c-c++-common/torture/pr101636.c: Likewise.
            * gcc.dg/vect/pr104782.c: New testcase.

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

* [Bug tree-optimization/101636] [11 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr')
  2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
                   ` (18 preceding siblings ...)
  2022-03-23 14:08 ` cvs-commit at gcc dot gnu.org
@ 2022-03-23 14:08 ` rguenth at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-23 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2022-03-23 14:08 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27  9:15 [Bug tree-optimization/101636] New: [11/12 Regression] ICE: verify_gimple failed (error: conversion of register to a different size in 'view_convert_expr') asolokha at gmx dot com
2021-07-27 11:30 ` [Bug tree-optimization/101636] " rguenth at gcc dot gnu.org
2021-07-28  7:07 ` rguenth at gcc dot gnu.org
2021-08-03 12:42 ` marxin at gcc dot gnu.org
2021-08-03 13:06 ` rguenther at suse dot de
2021-08-03 13:47 ` marxin at gcc dot gnu.org
2021-08-06  9:58 ` rguenth at gcc dot gnu.org
2021-11-08 11:27 ` rguenth at gcc dot gnu.org
2021-11-08 11:43 ` marxin at gcc dot gnu.org
2021-11-08 11:44 ` marxin at gcc dot gnu.org
2021-11-08 12:56 ` rguenther at suse dot de
2021-11-08 15:33 ` marxin at gcc dot gnu.org
2021-11-08 15:33 ` marxin at gcc dot gnu.org
2021-11-09  7:24 ` rguenther at suse dot de
2022-02-22 14:52 ` rguenth at gcc dot gnu.org
2022-02-23  9:21 ` rguenth at gcc dot gnu.org
2022-02-23 11:14 ` cvs-commit at gcc dot gnu.org
2022-02-23 11:15 ` [Bug tree-optimization/101636] [11 " rguenth at gcc dot gnu.org
2022-03-07 11:34 ` rguenth at gcc dot gnu.org
2022-03-23 14:08 ` cvs-commit at gcc dot gnu.org
2022-03-23 14:08 ` 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).