diff mbox series

[v2] middle-end: Fix ICE in poly-int.h due to SLP.

Message ID 487f5a41-1c7e-44f9-bfc3-bc196d6ae74f@arm.com
State New
Headers show
Series [v2] middle-end: Fix ICE in poly-int.h due to SLP. | expand

Commit Message

Richard Ball Feb. 1, 2024, 4:09 p.m. UTC
Adds a check to ensure that the input vector arguments
to a function are not variable length. Previously, only the
output vector of a function was checked.

The ICE in question is within the neon-sve-bridge.c test,
and is related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111268

gcc/ChangeLog:

        * tree-vect-slp.cc (vectorizable_slp_permutation_1):
        Add variable-length check for vector input arguments
        to a function.

Comments

Richard Sandiford Feb. 1, 2024, 4:44 p.m. UTC | #1
Richard Ball <richard.ball@arm.com> writes:
> Adds a check to ensure that the input vector arguments
> to a function are not variable length. Previously, only the
> output vector of a function was checked.
>
> The ICE in question is within the neon-sve-bridge.c test,
> and is related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111268
>
> gcc/ChangeLog:
>
>         * tree-vect-slp.cc (vectorizable_slp_permutation_1):
>         Add variable-length check for vector input arguments
>         to a function.

OK, thanks.  Sorry, I'd misunderstood the op_vectype suggestion and
thought it involved returning early from the existing loop.

Richard

> diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
> index 086377a9ac08528880c90bee3b1d1e08341a6288..7cf9504398c98cccfdba3b91c3e995f73f8b5d50 100644
> --- a/gcc/tree-vect-slp.cc
> +++ b/gcc/tree-vect-slp.cc
> @@ -8987,7 +8987,8 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, gimple_stmt_iterator *gsi,
>      {
>        /* Calculate every element of every permute mask vector explicitly,
>  	 instead of relying on the pattern described above.  */
> -      if (!nunits.is_constant (&npatterns))
> +      if (!nunits.is_constant (&npatterns)
> +	  || !TYPE_VECTOR_SUBPARTS (op_vectype).is_constant ())
>  	return -1;
>        nelts_per_pattern = ncopies = 1;
>        if (loop_vec_info linfo = dyn_cast <loop_vec_info> (vinfo))
diff mbox series

Patch

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 086377a9ac08528880c90bee3b1d1e08341a6288..7cf9504398c98cccfdba3b91c3e995f73f8b5d50 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -8987,7 +8987,8 @@  vectorizable_slp_permutation_1 (vec_info *vinfo, gimple_stmt_iterator *gsi,
     {
       /* Calculate every element of every permute mask vector explicitly,
 	 instead of relying on the pattern described above.  */
-      if (!nunits.is_constant (&npatterns))
+      if (!nunits.is_constant (&npatterns)
+	  || !TYPE_VECTOR_SUBPARTS (op_vectype).is_constant ())
 	return -1;
       nelts_per_pattern = ncopies = 1;
       if (loop_vec_info linfo = dyn_cast <loop_vec_info> (vinfo))