diff mbox series

[077/nnn] poly_int: vect_get_constant_vectors

Message ID 87mv4hhitu.fsf@linaro.org
State New
Headers show
Series [077/nnn] poly_int: vect_get_constant_vectors | expand

Commit Message

Richard Sandiford Oct. 23, 2017, 5:31 p.m. UTC
For now, vect_get_constant_vectors can only cope with constant-length
vectors, although a patch after the main SVE submission relaxes this.
This patch adds an appropriate guard for variable-length vectors.
The TYPE_VECTOR_SUBPARTS use in vect_get_constant_vectors will then
have a to_constant call when TYPE_VECTOR_SUBPARTS becomes a poly_int.


2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
	constant and extern definitions for variable-length vectors.
	(vect_get_constant_vectors): Note that the number of units
	is known to be constant.

Comments

Jeff Law Nov. 28, 2017, 4:36 p.m. UTC | #1
On 10/23/2017 11:31 AM, Richard Sandiford wrote:
> For now, vect_get_constant_vectors can only cope with constant-length

> vectors, although a patch after the main SVE submission relaxes this.

> This patch adds an appropriate guard for variable-length vectors.

> The TYPE_VECTOR_SUBPARTS use in vect_get_constant_vectors will then

> have a to_constant call when TYPE_VECTOR_SUBPARTS becomes a poly_int.

> 

> 

> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>

> 	    Alan Hayward  <alan.hayward@arm.com>

> 	    David Sherwood  <david.sherwood@arm.com>

> 

> gcc/

> 	* tree-vect-slp.c (vect_get_and_check_slp_defs): Reject

> 	constant and extern definitions for variable-length vectors.

> 	(vect_get_constant_vectors): Note that the number of units

> 	is known to be constant.

OK.
jeff

ps.  Sorry about the strange ordering of acks.  I'm trying to work
through the simple stuff and come back to the larger patches.  The only
way to eat an elephant is a bite at a time...
diff mbox series

Patch

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c	2017-10-23 17:22:32.728227020 +0100
+++ gcc/tree-vect-slp.c	2017-10-23 17:22:42.827179461 +0100
@@ -403,6 +403,20 @@  vect_get_and_check_slp_defs (vec_info *v
 	{
 	case vect_constant_def:
 	case vect_external_def:
+	  /* We must already have set a vector size by now.  */
+	  gcc_checking_assert (maybe_nonzero (current_vector_size));
+	  if (!current_vector_size.is_constant ())
+	    {
+	      if (dump_enabled_p ())
+		{
+		  dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+				   "Build SLP failed: invalid type of def "
+				   "for variable-length SLP ");
+		  dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd);
+		  dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
+		}
+	      return -1;
+	    }
 	  break;
 
 	case vect_reduction_def:
@@ -3219,6 +3233,7 @@  vect_get_constant_vectors (tree op, slp_
       = build_same_sized_truth_vector_type (STMT_VINFO_VECTYPE (stmt_vinfo));
   else
     vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
+  /* Enforced by vect_get_and_check_slp_defs.  */
   nunits = TYPE_VECTOR_SUBPARTS (vector_type);
 
   if (STMT_VINFO_DATA_REF (stmt_vinfo))