aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-01-03 07:16:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-01-03 07:16:35 +0000
commita23644f23da672210ea6a443cefb7cd17111b160 (patch)
tree38ba2c3436c87fbfe2689af647dde5be2eea06fb
parent062d5ccc1180aa6bca717309d26408a029af1fd7 (diff)
downloadgcc-a23644f23da672210ea6a443cefb7cd17111b160.zip
gcc-a23644f23da672210ea6a443cefb7cd17111b160.tar.gz
gcc-a23644f23da672210ea6a443cefb7cd17111b160.tar.bz2
poly_int: vect_get_constant_vectors
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. 2018-01-03 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. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256140
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/tree-vect-slp.c15
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 87c70af..c25eb15 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,15 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * 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.
+
+2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* tree-vect-stmts.c (vectorizable_conversion): Treat the number
of units as polynomial. Choose between WIDE and NARROW based
on multiple_p.
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 7d8c352..4aa816f 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -405,6 +405,20 @@ again:
{
case vect_constant_def:
case vect_external_def:
+ /* We must already have set a vector size by now. */
+ gcc_checking_assert (maybe_ne (current_vector_size, 0U));
+ 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:
@@ -3233,6 +3247,7 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
= 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))