aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-09-17 11:20:10 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2024-09-19 13:28:16 +0200
commit5e3a4a01785e2d5135528a07bb8116af9c55ddf8 (patch)
tree7da047a3689eb26bbeb02e17cc8c5b67d74ab2b3 /gcc/tree-vect-loop.cc
parentde915fbe3cb1ce7be35dce7d6bc8d04dc7125e61 (diff)
downloadgcc-5e3a4a01785e2d5135528a07bb8116af9c55ddf8.zip
gcc-5e3a4a01785e2d5135528a07bb8116af9c55ddf8.tar.gz
gcc-5e3a4a01785e2d5135528a07bb8116af9c55ddf8.tar.bz2
tree-optimization/116573 - .SELECT_VL for SLP
The following restores the use of .SELECT_VL for testcases where it is safe to use even when using SLP. I've for now restricted it to single-lane SLP plus optimistically allow store-lane nodes and assume single-lane roots are not widened but at most to load-lane who should be fine. PR tree-optimization/116573 * tree-vect-loop.cc (vect_analyze_loop_2): Allow .SELECV_VL for SLP but disable it when there's multi-lane instances. * tree-vect-stmts.cc (vectorizable_store): Only compute the ptr increment when generating code. (vectorizable_load): Likewise.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d42694d..c6778ab 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -3084,10 +3084,23 @@ start_over:
if (direct_internal_fn_supported_p (IFN_SELECT_VL, iv_type,
OPTIMIZE_FOR_SPEED)
&& LOOP_VINFO_LENS (loop_vinfo).length () == 1
- && LOOP_VINFO_LENS (loop_vinfo)[0].factor == 1 && !slp
+ && LOOP_VINFO_LENS (loop_vinfo)[0].factor == 1
&& (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
|| !LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant ()))
LOOP_VINFO_USING_SELECT_VL_P (loop_vinfo) = true;
+
+ /* If any of the SLP instances cover more than a single lane
+ we cannot use .SELECT_VL at the moment, even if the number
+ of lanes is uniform throughout the SLP graph. */
+ if (LOOP_VINFO_USING_SELECT_VL_P (loop_vinfo))
+ for (slp_instance inst : LOOP_VINFO_SLP_INSTANCES (loop_vinfo))
+ if (SLP_TREE_LANES (SLP_INSTANCE_TREE (inst)) != 1
+ && !(SLP_INSTANCE_KIND (inst) == slp_inst_kind_store
+ && SLP_INSTANCE_TREE (inst)->ldst_lanes))
+ {
+ LOOP_VINFO_USING_SELECT_VL_P (loop_vinfo) = false;
+ break;
+ }
}
/* Decide whether this loop_vinfo should use partial vectors or peeling,