From 43fdde5738ea0554fa000987e9769add027f4876 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 21 Oct 2019 06:41:05 +0000 Subject: [PATCH] Pass a vec_info to can_duplicate_and_interleave_p 2019-10-21 Richard Sandiford gcc/ * tree-vectorizer.h (can_duplicate_and_interleave_p): Take a vec_info. * tree-vect-slp.c (can_duplicate_and_interleave_p): Likewise. (duplicate_and_interleave): Update call accordingly. * tree-vect-loop.c (vectorizable_reduction): Likewise. From-SVN: r277229 --- gcc/ChangeLog | 7 +++++++ gcc/tree-vect-loop.c | 3 ++- gcc/tree-vect-slp.c | 9 +++++---- gcc/tree-vectorizer.h | 3 ++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 67b640cb422..efb89174cab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-10-21 Richard Sandiford + + * tree-vectorizer.h (can_duplicate_and_interleave_p): Take a vec_info. + * tree-vect-slp.c (can_duplicate_and_interleave_p): Likewise. + (duplicate_and_interleave): Update call accordingly. + * tree-vect-loop.c (vectorizable_reduction): Likewise. + 2019-10-21 Richard Sandiford * tree-vectorizer.h (duplicate_and_interleave): Take a vec_info. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index ecd972473b8..21a0eaeb6cc 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6145,7 +6145,8 @@ vectorizable_reduction (stmt_vec_info stmt_info, slp_tree slp_node, unsigned int group_size = SLP_INSTANCE_GROUP_SIZE (slp_node_instance); scalar_mode elt_mode = SCALAR_TYPE_MODE (TREE_TYPE (vectype_out)); if (!neutral_op - && !can_duplicate_and_interleave_p (group_size, elt_mode)) + && !can_duplicate_and_interleave_p (loop_vinfo, group_size, + elt_mode)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index cf1ff5a2941..ddb6086fbc9 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -233,7 +233,8 @@ vect_get_place_in_interleaving_chain (stmt_vec_info stmt_info, (if nonnull). */ bool -can_duplicate_and_interleave_p (unsigned int count, machine_mode elt_mode, +can_duplicate_and_interleave_p (vec_info *, unsigned int count, + machine_mode elt_mode, unsigned int *nvectors_out, tree *vector_type_out, tree *permutes) @@ -432,7 +433,7 @@ again: || dt == vect_external_def) && !current_vector_size.is_constant () && (TREE_CODE (type) == BOOLEAN_TYPE - || !can_duplicate_and_interleave_p (stmts.length (), + || !can_duplicate_and_interleave_p (vinfo, stmts.length (), TYPE_MODE (type)))) { if (dump_enabled_p ()) @@ -3183,7 +3184,7 @@ vect_mask_constant_operand_p (stmt_vec_info stmt_vinfo) to cut down on the number of interleaves. */ void -duplicate_and_interleave (vec_info *, gimple_seq *seq, tree vector_type, +duplicate_and_interleave (vec_info *vinfo, gimple_seq *seq, tree vector_type, vec elts, unsigned int nresults, vec &results) { @@ -3194,7 +3195,7 @@ duplicate_and_interleave (vec_info *, gimple_seq *seq, tree vector_type, unsigned int nvectors = 1; tree new_vector_type; tree permutes[2]; - if (!can_duplicate_and_interleave_p (nelts, TYPE_MODE (element_type), + if (!can_duplicate_and_interleave_p (vinfo, nelts, TYPE_MODE (element_type), &nvectors, &new_vector_type, permutes)) gcc_unreachable (); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index ef5492536dc..e363d27eee5 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1751,7 +1751,8 @@ extern void vect_get_slp_defs (vec , slp_tree, vec > *); extern bool vect_slp_bb (basic_block); extern stmt_vec_info vect_find_last_scalar_stmt_in_slp (slp_tree); extern bool is_simple_and_all_uses_invariant (stmt_vec_info, loop_vec_info); -extern bool can_duplicate_and_interleave_p (unsigned int, machine_mode, +extern bool can_duplicate_and_interleave_p (vec_info *, unsigned int, + machine_mode, unsigned int * = NULL, tree * = NULL, tree * = NULL); extern void duplicate_and_interleave (vec_info *, gimple_seq *, tree, -- 2.30.2