diff options
author | Richard Biener <rguenther@suse.de> | 2017-07-20 11:17:21 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-07-20 11:17:21 +0000 |
commit | 891ad31c7b151704de655a1a2b70568830a65086 (patch) | |
tree | 4f6d0ffbb5e74aa6bcb4ebf183760b0d678a438f /gcc/tree-vectorizer.h | |
parent | f971b2813d7ddbdba210a63290b790a175777679 (diff) | |
download | gcc-891ad31c7b151704de655a1a2b70568830a65086.zip gcc-891ad31c7b151704de655a1a2b70568830a65086.tar.gz gcc-891ad31c7b151704de655a1a2b70568830a65086.tar.bz2 |
re PR tree-optimization/61171 (vectorization fails for a reduction in presence of subtraction)
2017-07-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/61171
* tree-vectorizer.h (slp_instance): Add reduc_phis member.
(vect_analyze_stmt): Add slp instance parameter.
(vectorizable_reduction): Likewise.
* tree-vect-loop.c (vect_analyze_loop_operations): Adjust.
(vect_is_simple_reduction): Deal with chains not detected
as SLP reduction chain, specifically not properly associated
chains containing a mix of plus/minus.
(get_reduction_op): Remove.
(get_initial_defs_for_reduction): Simplify, pass in whether
this is a reduction chain, pass in the SLP node for the PHIs.
(vect_create_epilog_for_reduction): Get the SLP instance as
arg and adjust.
(vectorizable_reduction): Get the SLP instance as arg.
During analysis remember the SLP node with the PHIs in the
instance. Simplify getting at the vectorized reduction PHIs.
* tree-vect-slp.c (vect_slp_analyze_node_operations): Pass
through SLP instance.
(vect_slp_analyze_operations): Likewise.
* tree-vect-stms.c (vect_analyze_stmt): Likewise.
(vect_transform_stmt): Likewise.
* g++.dg/vect/pr61171.cc: New testcase.
* gfortran.dg/vect/pr61171.f: Likewise.
* gcc.dg/vect/vect-reduc-11.c: Likewise.
From-SVN: r250382
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 8935e78..accac72 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -127,6 +127,9 @@ typedef struct _slp_instance { /* The group of nodes that contain loads of this SLP instance. */ vec<slp_tree> loads; + + /* The SLP node containing the reduction PHIs. */ + slp_tree reduc_phis; } *slp_instance; @@ -1107,7 +1110,7 @@ extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree); extern bool vect_transform_stmt (gimple *, gimple_stmt_iterator *, bool *, slp_tree, slp_instance); extern void vect_remove_stores (gimple *); -extern bool vect_analyze_stmt (gimple *, bool *, slp_tree); +extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance); extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *, gimple **, tree, int, slp_tree); extern void vect_get_load_cost (struct data_reference *, int, bool, @@ -1178,7 +1181,7 @@ extern loop_vec_info vect_analyze_loop_form (struct loop *); extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *, slp_tree, int, gimple **); extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *, - gimple **, slp_tree); + gimple **, slp_tree, slp_instance); extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *, gimple **, slp_tree); extern tree get_initial_def_for_reduction (gimple *, tree, tree *); |