diff options
author | Richard Biener <rguenther@suse.de> | 2025-02-07 08:46:31 +0100 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-02-07 13:39:58 +0100 |
commit | 4931a637479aba35e35c50a86f58ecd6262bc487 (patch) | |
tree | da27a0927dcfccf0714efcdf50180df2163d8e0c /gcc/tree-vectorizer.h | |
parent | 6aa3329b3430c6362ddf51e403d147e0b10d7401 (diff) | |
download | gcc-4931a637479aba35e35c50a86f58ecd6262bc487.zip gcc-4931a637479aba35e35c50a86f58ecd6262bc487.tar.gz gcc-4931a637479aba35e35c50a86f58ecd6262bc487.tar.bz2 |
tree-optimization/115538 - possible wrong-code with SLP conversion
The following fixes a latent issue where we use ranges to verify
correctness of a vector conversion optimization. We rely on ranges
from 'op0' which for SLP is extracted from the representative stmt
which does not necessarily correspond to any actual scalar operation.
We also do not verify the range of all scalar lanes in the SLP
operand match. The following rectifies this, restricting the support
to single-lane SLP nodes at this point - on branches we'd simply
not perform this optimization with SLP.
PR tree-optimization/115538
* tree-vectorizer.h (vect_get_slp_scalar_def): Declare.
* tree-vect-slp.cc (vect_get_slp_scalar_def): New helper.
* tree-vect-generic.cc (expand_vector_conversion): Adjust.
* tree-vect-stmts.cc (vectorizable_conversion): For SLP
correctly look at ranges of the scalar defs of the SLP operand.
(supportable_indirect_convert_operation): Likewise.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 44d3a1d..b0cb081 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2345,7 +2345,8 @@ extern bool supportable_narrowing_operation (code_helper, tree, tree, extern bool supportable_indirect_convert_operation (code_helper, tree, tree, vec<std::pair<tree, tree_code> > &, - tree = NULL_TREE); + tree = NULL_TREE, + slp_tree = NULL); extern int compare_step_with_zero (vec_info *, stmt_vec_info); extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, @@ -2598,6 +2599,7 @@ extern bool vect_make_slp_decision (loop_vec_info); extern void vect_detect_hybrid_slp (loop_vec_info); extern void vect_optimize_slp (vec_info *); extern void vect_gather_slp_loads (vec_info *); +extern tree vect_get_slp_scalar_def (slp_tree, unsigned); extern void vect_get_slp_defs (slp_tree, vec<tree> *); extern void vect_get_slp_defs (vec_info *, slp_tree, vec<vec<tree> > *, unsigned n = -1U); |