re PR tree-optimization/61171 (vectorization fails for a reduction in presence of...
authorRichard Biener <rguenther@suse.de>
Thu, 20 Jul 2017 11:17:21 +0000 (11:17 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 20 Jul 2017 11:17:21 +0000 (11:17 +0000)
commit891ad31c7b151704de655a1a2b70568830a65086
tree4f6d0ffbb5e74aa6bcb4ebf183760b0d678a438f
parentf971b2813d7ddbdba210a63290b790a175777679
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
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/vect/pr61171.cc [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/vect-reduc-11.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/vect/pr61171.f [new file with mode: 0644]
gcc/tree-vect-loop.c
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h