[gcc r15-1053] Relax COND_EXPR reduction vectorization SLP restriction
Richard Biener
rguenth@gcc.gnu.org
Thu Jun 6 06:56:19 GMT 2024
https://gcc.gnu.org/g:28edeb1409a7b839407ec06031899b933390bff3
commit r15-1053-g28edeb1409a7b839407ec06031899b933390bff3
Author: Richard Biener <rguenther@suse.de>
Date: Fri Feb 23 16:16:38 2024 +0100
Relax COND_EXPR reduction vectorization SLP restriction
Allow one-lane SLP but for the case where we need to swap the arms.
* tree-vect-stmts.cc (vectorizable_condition): Allow
single-lane SLP, but not when we need to swap then and
else clause.
Diff:
---
gcc/tree-vect-stmts.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index b26cc74f417..c82381e799e 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -12116,7 +12116,7 @@ vectorizable_condition (vec_info *vinfo,
= STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info)) != NULL;
if (for_reduction)
{
- if (slp_node)
+ if (slp_node && SLP_TREE_LANES (slp_node) > 1)
return false;
reduc_info = info_for_reduction (vinfo, stmt_info);
reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
@@ -12205,6 +12205,10 @@ vectorizable_condition (vec_info *vinfo,
cond_expr = NULL_TREE;
}
}
+ /* ??? The vectorized operand query below doesn't allow swapping
+ this way for SLP. */
+ if (slp_node)
+ return false;
std::swap (then_clause, else_clause);
}
More information about the Gcc-cvs
mailing list