diff mbox series

Fix an SVE failure in the Fortran matmul* tests

Message ID 87wp50me3l.fsf@linaro.org
State New
Headers show
Series Fix an SVE failure in the Fortran matmul* tests | expand

Commit Message

Richard Sandiford Sept. 15, 2017, 10:49 a.m. UTC
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.

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
OK to install?

Richard


2017-09-15  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.

Comments

Jeff Law Sept. 15, 2017, 3:52 p.m. UTC | #1
On 09/15/2017 04:49 AM, Richard Sandiford wrote:
> 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.

> 

> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.

> OK to install?

> 

> Richard

> 

> 

> 2017-09-15  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.

OK.
jeff
diff mbox series

Patch

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	2017-09-14 17:35:26.634355297 +0100
+++ gcc/tree-vect-data-refs.c	2017-09-15 11:41:22.764283196 +0100
@@ -118,6 +118,11 @@  vect_get_smallest_scalar_type (gimple *s
   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)