diff options
author | Richard Biener <rguenther@suse.de> | 2025-03-03 14:12:37 +0100 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-03-04 09:24:31 +0100 |
commit | 10e4107dfcf9fe324d0902f16411a75c596dab91 (patch) | |
tree | df339b4f6fb5d02ab85e4a2887cc557e32337fd2 /gcc/tree-vect-loop.cc | |
parent | bfb9276f344cbc6794379d61d0279dfc3a7441b3 (diff) | |
download | gcc-10e4107dfcf9fe324d0902f16411a75c596dab91.zip gcc-10e4107dfcf9fe324d0902f16411a75c596dab91.tar.gz gcc-10e4107dfcf9fe324d0902f16411a75c596dab91.tar.bz2 |
tree-optimization/119096 - bogus conditional reduction vectorization
When we vectorize a .COND_ADD reduction and apply the single-use-def
cycle optimization we can end up chosing the wrong else value for
subsequent .COND_ADD. The following rectifies this.
PR tree-optimization/119096
* tree-vect-loop.cc (vect_transform_reduction): Use the
correct else value for .COND_fn.
* gcc.dg/vect/pr119096.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r-- | gcc/tree-vect-loop.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index dc15b95..5253362 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -9064,7 +9064,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo, new_stmt = gimple_build_call_internal (internal_fn (code), op.num_ops, vop[0], vop[1], vop[2], - vop[1]); + vop[reduc_index]); else new_stmt = gimple_build_assign (vec_dest, tree_code (op.code), vop[0], vop[1], vop[2]); |