aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-07-06 09:56:23 +0200
committerRichard Biener <rguenther@suse.de>2023-07-06 12:48:56 +0200
commitdeebf06a1207bf7d84f4bebc462137d9436ee6dd (patch)
tree871aea9f74a7a2c5c8f16c0094bc07f94d671dbf
parent79a90e69ec9faf53ba84391f3c558e552711f6a6 (diff)
downloadgcc-deebf06a1207bf7d84f4bebc462137d9436ee6dd.zip
gcc-deebf06a1207bf7d84f4bebc462137d9436ee6dd.tar.gz
gcc-deebf06a1207bf7d84f4bebc462137d9436ee6dd.tar.bz2
tree-optimization/110563 - simplify epilogue VF checks
The following consolidates an assert that now hits for ppc64le with an earlier check we already do, simplifying vect_determine_partial_vectors_and_peeling and getting rid of its now redundant argument. PR tree-optimization/110563 * tree-vectorizer.h (vect_determine_partial_vectors_and_peeling): Remove second argument. * tree-vect-loop.cc (vect_determine_partial_vectors_and_peeling): Remove for_epilogue_p argument. Merge assert ... (vect_analyze_loop_2): ... with check done before determining partial vectors by moving it after. * tree-vect-loop-manip.cc (vect_do_peeling): Adjust.
-rw-r--r--gcc/tree-vect-loop-manip.cc3
-rw-r--r--gcc/tree-vect-loop.cc54
-rw-r--r--gcc/tree-vectorizer.h3
3 files changed, 19 insertions, 41 deletions
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 6c452e0..d66d4a6 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3461,8 +3461,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
a multiple of the epilogue loop's vectorization factor.
We should have rejected the loop during the analysis phase
if this fails. */
- bool res = vect_determine_partial_vectors_and_peeling (epilogue_vinfo,
- true);
+ bool res = vect_determine_partial_vectors_and_peeling (epilogue_vinfo);
gcc_assert (res);
}
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 4d9abd0..36d19a5 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2494,16 +2494,10 @@ vect_dissolve_slp_only_groups (loop_vec_info loop_vinfo)
In this case:
LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P == false
-
- When FOR_EPILOGUE_P is true, make this determination based on the
- assumption that LOOP_VINFO is an epilogue loop, otherwise make it
- based on the assumption that LOOP_VINFO is the main loop. The caller
- has made sure that the number of iterations is set appropriately for
- this value of FOR_EPILOGUE_P. */
+ */
opt_result
-vect_determine_partial_vectors_and_peeling (loop_vec_info loop_vinfo,
- bool for_epilogue_p)
+vect_determine_partial_vectors_and_peeling (loop_vec_info loop_vinfo)
{
/* Determine whether there would be any scalar iterations left over. */
bool need_peeling_or_partial_vectors_p
@@ -2537,25 +2531,12 @@ vect_determine_partial_vectors_and_peeling (loop_vec_info loop_vinfo,
}
if (dump_enabled_p ())
- {
- if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
- dump_printf_loc (MSG_NOTE, vect_location,
- "operating on partial vectors%s.\n",
- for_epilogue_p ? " for epilogue loop" : "");
- else
- dump_printf_loc (MSG_NOTE, vect_location,
- "operating only on full vectors%s.\n",
- for_epilogue_p ? " for epilogue loop" : "");
- }
-
- if (for_epilogue_p)
- {
- loop_vec_info orig_loop_vinfo = LOOP_VINFO_ORIG_LOOP_INFO (loop_vinfo);
- gcc_assert (orig_loop_vinfo);
- if (!LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
- gcc_assert (known_lt (LOOP_VINFO_VECT_FACTOR (loop_vinfo),
- LOOP_VINFO_VECT_FACTOR (orig_loop_vinfo)));
- }
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "operating on %s vectors%s.\n",
+ LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
+ ? "partial" : "full",
+ LOOP_VINFO_EPILOGUE_P (loop_vinfo)
+ ? " for epilogue loop" : "");
LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo)
= (!LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
@@ -3017,11 +2998,19 @@ start_over:
LOOP_VINFO_USING_SELECT_VL_P (loop_vinfo) = true;
}
+ /* Decide whether this loop_vinfo should use partial vectors or peeling,
+ assuming that the loop will be used as a main loop. We will redo
+ this analysis later if we instead decide to use the loop as an
+ epilogue loop. */
+ ok = vect_determine_partial_vectors_and_peeling (loop_vinfo);
+ if (!ok)
+ return ok;
+
/* If we're vectorizing an epilogue loop, the vectorized loop either needs
to be able to handle fewer than VF scalars, or needs to have a lower VF
than the main loop. */
if (LOOP_VINFO_EPILOGUE_P (loop_vinfo)
- && !LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo))
+ && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
{
poly_uint64 unscaled_vf
= exact_div (LOOP_VINFO_VECT_FACTOR (orig_loop_vinfo),
@@ -3032,15 +3021,6 @@ start_over:
" epilogue loop.\n");
}
- /* Decide whether this loop_vinfo should use partial vectors or peeling,
- assuming that the loop will be used as a main loop. We will redo
- this analysis later if we instead decide to use the loop as an
- epilogue loop. */
- ok = vect_determine_partial_vectors_and_peeling
- (loop_vinfo, LOOP_VINFO_EPILOGUE_P (loop_vinfo));
- if (!ok)
- return ok;
-
/* Check the costings of the loop make vectorizing worthwhile. */
res = vect_analyze_loop_costing (loop_vinfo, suggested_unroll_factor);
if (res < 0)
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index a36974c..6b1cf6d 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2316,8 +2316,7 @@ extern tree neutral_op_for_reduction (tree, code_helper, tree);
extern widest_int vect_iv_limit_for_partial_vectors (loop_vec_info loop_vinfo);
bool vect_rgroup_iv_might_wrap_p (loop_vec_info, rgroup_controls *);
/* Used in tree-vect-loop-manip.cc */
-extern opt_result vect_determine_partial_vectors_and_peeling (loop_vec_info,
- bool);
+extern opt_result vect_determine_partial_vectors_and_peeling (loop_vec_info);
/* Used in gimple-loop-interchange.c and tree-parloops.cc. */
extern bool check_reduction_path (dump_user_location_t, loop_p, gphi *, tree,
enum tree_code);