diff options
author | Richard Biener <rguenther@suse.de> | 2022-10-13 14:24:05 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-10-13 15:17:06 +0200 |
commit | 5cbaf84c191b9a3e3cb26545c808d208bdbf2ab5 (patch) | |
tree | 448937298d1f04e9867d62e5370b6245df7aecbf /gcc/tree-vect-loop.cc | |
parent | 5364b425934436b9ba52bd95ed8a8a19ce7af207 (diff) | |
download | gcc-5cbaf84c191b9a3e3cb26545c808d208bdbf2ab5.zip gcc-5cbaf84c191b9a3e3cb26545c808d208bdbf2ab5.tar.gz gcc-5cbaf84c191b9a3e3cb26545c808d208bdbf2ab5.tar.bz2 |
tree-optimization/107160 - avoid reusing multiple accumulators
Epilogue vectorization is not set up to re-use a vectorized
accumulator consisting of more than one vector. For non-SLP
we always reduce to a single but for SLP that isn't happening.
In such case we currenlty miscompile the epilog so avoid this.
PR tree-optimization/107160
* tree-vect-loop.cc (vect_create_epilog_for_reduction):
Do not register accumulator if we failed to reduce it
to a single vector.
* gcc.dg/vect/pr107160.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r-- | gcc/tree-vect-loop.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 1996ecf..b1442a9 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -6232,7 +6232,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, } /* Record this operation if it could be reused by the epilogue loop. */ - if (STMT_VINFO_REDUC_TYPE (reduc_info) == TREE_CODE_REDUCTION) + if (STMT_VINFO_REDUC_TYPE (reduc_info) == TREE_CODE_REDUCTION + && vec_num == 1) loop_vinfo->reusable_accumulators.put (scalar_results[0], { orig_reduc_input, reduc_info }); |