The following fixes a mixup of vector types checked when looking
at a conditional reduction operation. We want the actual data
vector type, so look at the reduc-idx operand, not operand zero,
which in case of a conditional operation is the mask.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
PR tree-optimization/122292
* tree-vect-loop.cc (vect_transform_reduction): Look at
the correct vector input type.
---
gcc/tree-vect-loop.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index f523b264dfc..3f3378a8214 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7810,7 +7810,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
assumption is not true: we use reduc_index to record the index of the
reduction variable. */
int reduc_index = SLP_TREE_REDUC_IDX (slp_node);
- tree vectype_in = SLP_TREE_VECTYPE (SLP_TREE_CHILDREN (slp_node)[0]);
+ tree vectype_in = SLP_TREE_VECTYPE (SLP_TREE_CHILDREN
(slp_node)[reduc_index]);
vec_num = vect_get_num_copies (loop_vinfo, SLP_TREE_CHILDREN (slp_node)[0]);
--
2.51.0