Fix an SVE failure in the Fortran matmul* tests
authorRichard Sandiford <richard.sandiford@linaro.org>
Mon, 18 Sep 2017 15:42:08 +0000 (15:42 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 18 Sep 2017 15:42:08 +0000 (15:42 +0000)
The vectoriser was calling vect_get_smallest_scalar_type without
having proven that the type actually is a scalar.  This seems to
be the intended behaviour: the ultimate test of whether the type
is interesting (and hence scalar) is whether an associated vector
type exists, but this is only tested later.

The patch simply makes the function cope gracefully with non-scalar
inputs.

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

gcc/
* tree-vect-data-refs.c (vect_get_smallest_scalar_type): Cope
with types that aren't in fact scalar.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r252934

gcc/ChangeLog
gcc/tree-vect-data-refs.c

index 130793eaf5a0c28cfe3728ed514fbcee0641b0ec..2f8cde4ebee963e15af66033f0f737022e4acae4 100644 (file)
@@ -1,3 +1,10 @@
+2017-09-18  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Cope
+       with types that aren't in fact scalar.
+
 2017-09-18  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * tree-vect-slp.c (vect_record_max_nunits): New function,
index c409dc71a49ec6e55fcf6199304aec3017c7afb3..cab2f2f935bdf1b3479799a93539e53248f0696f 100644 (file)
@@ -118,6 +118,11 @@ vect_get_smallest_scalar_type (gimple *stmt, HOST_WIDE_INT *lhs_size_unit,
   tree scalar_type = gimple_expr_type (stmt);
   HOST_WIDE_INT lhs, rhs;
 
+  /* During the analysis phase, this function is called on arbitrary
+     statements that might not have scalar results.  */
+  if (!tree_fits_uhwi_p (TYPE_SIZE_UNIT (scalar_type)))
+    return scalar_type;
+
   lhs = rhs = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (scalar_type));
 
   if (is_gimple_assign (stmt)