From f48e4da3259d52076f86aa081cece40dfda7b235 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 29 Aug 2019 08:07:35 +0000 Subject: re PR tree-optimization/91568 (internal compiler error: in vect_schedule_slp_instance, at tree-vect-slp.c:3922) 2019-08-29 Richard Biener PR tree-optimization/91568 * tree-vectorizer.h (_slp_tree::max_nunits): Add. (vect_update_max_nunits): Add overload for poly_uint64. * tree-vect-slp.c (vect_create_new_slp_node): Initialize it. (vect_build_slp_tree): Record max_nunits into the subtree and merge it upwards. (vect_print_slp_tree): Print max_nunits. * gfortran.dg/pr91568.f: New testcase. From-SVN: r275023 --- gcc/tree-vectorizer.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'gcc/tree-vectorizer.h') diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 1456cde..05ad1c6 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -132,6 +132,9 @@ struct _slp_tree { unsigned int vec_stmts_size; /* Reference count in the SLP graph. */ unsigned int refcnt; + /* The maximum number of vector elements for the subtree rooted + at this node. */ + poly_uint64 max_nunits; /* Whether the scalar computations use two different operators. */ bool two_operators; /* The DEF type of this node. */ @@ -1375,19 +1378,27 @@ vect_get_num_copies (loop_vec_info loop_vinfo, tree vectype) } /* Update maximum unit count *MAX_NUNITS so that it accounts for - the number of units in vector type VECTYPE. *MAX_NUNITS can be 1 - if we haven't yet recorded any vector types. */ + NUNITS. *MAX_NUNITS can be 1 if we haven't yet recorded anything. */ static inline void -vect_update_max_nunits (poly_uint64 *max_nunits, tree vectype) +vect_update_max_nunits (poly_uint64 *max_nunits, poly_uint64 nunits) { /* All unit counts have the form current_vector_size * X for some rational X, so two unit sizes must have a common multiple. Everything is a multiple of the initial value of 1. */ - poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); *max_nunits = force_common_multiple (*max_nunits, nunits); } +/* Update maximum unit count *MAX_NUNITS so that it accounts for + the number of units in vector type VECTYPE. *MAX_NUNITS can be 1 + if we haven't yet recorded any vector types. */ + +static inline void +vect_update_max_nunits (poly_uint64 *max_nunits, tree vectype) +{ + vect_update_max_nunits (max_nunits, TYPE_VECTOR_SUBPARTS (vectype)); +} + /* Return the vectorization factor that should be used for costing purposes while vectorizing the loop described by LOOP_VINFO. Pick a reasonable estimate if the vectorization factor isn't -- cgit v1.1