diff options
author | Richard Biener <rguenther@suse.de> | 2025-07-09 11:23:30 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2025-07-09 13:11:39 +0200 |
commit | 591d8f3b273627cc42171e778014b84370091e44 (patch) | |
tree | 35e08218ad9856e7bdddcf7674e13a4088de6b2b | |
parent | 8f1cc1ceabdac21940fa0638298d8a3b7c941d4a (diff) | |
download | gcc-591d8f3b273627cc42171e778014b84370091e44.zip gcc-591d8f3b273627cc42171e778014b84370091e44.tar.gz gcc-591d8f3b273627cc42171e778014b84370091e44.tar.bz2 |
Avoid accessing STMT_VINFO_VECTYPE
The following fixes up two places we access STMT_VINFO_VECTYPE that's
not covered by the fixup in vect_analyze/transform_stmt to set that
from SLP_TREE_VECTYPE.
* tree-vect-loop.cc (vectorizable_reduction): Get the
output vector type from slp_for_stmt_info.
* tree-vect-stmts.cc (vect_analyze_stmt): Bail out earlier
for PURE_SLP_STMT when doing loop stmt analysis.
-rw-r--r-- | gcc/tree-vect-loop.cc | 2 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.cc | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index d5044d5..42e0015 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -7822,7 +7822,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, inside the loop body. The last operand is the reduction variable, which is defined by the loop-header-phi. */ - tree vectype_out = STMT_VINFO_VECTYPE (stmt_info); + tree vectype_out = SLP_TREE_VECTYPE (slp_for_stmt_info); STMT_VINFO_REDUC_VECTYPE (reduc_info) = vectype_out; STMT_VINFO_REDUC_VECTYPE_IN (reduc_info) = vectype_in; diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 5767a35..da20127 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -13368,6 +13368,14 @@ vect_analyze_stmt (vec_info *vinfo, gcc_unreachable (); } + if (PURE_SLP_STMT (stmt_info) && !node) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "handled only by SLP analysis\n"); + return opt_result::success (); + } + tree saved_vectype = STMT_VINFO_VECTYPE (stmt_info); if (node) STMT_VINFO_VECTYPE (stmt_info) = SLP_TREE_VECTYPE (node); @@ -13381,14 +13389,6 @@ vect_analyze_stmt (vec_info *vinfo, *need_to_vectorize = true; } - if (PURE_SLP_STMT (stmt_info) && !node) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, vect_location, - "handled only by SLP analysis\n"); - return opt_result::success (); - } - /* When we arrive here with a non-SLP statement and we are supposed to use SLP for everything fail vectorization. */ if (!node) |