From 0b86fa32a5d7ae465f86e0149546d30e813d3c2f Mon Sep 17 00:00:00 2001 From: rsandifo Date: Mon, 18 Sep 2017 15:42:08 +0000 Subject: [PATCH] Fix an SVE failure in the Fortran matmul* tests 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 Alan Hayward David Sherwood gcc/ * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Cope with types that aren't in fact scalar. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252934 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/tree-vect-data-refs.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 130793eaf5a..2f8cde4ebee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,11 @@ 2017-09-18 Richard Sandiford + Alan Hayward + David Sherwood + + * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Cope + with types that aren't in fact scalar. + +2017-09-18 Richard Sandiford * tree-vect-slp.c (vect_record_max_nunits): New function, split out from... diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index c409dc71a49..cab2f2f935b 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -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) -- 2.11.4.GIT