aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-10-31 09:55:35 +0100
committerRichard Biener <rguenth@gcc.gnu.org>2024-11-04 12:23:04 +0100
commit6cbe075be7489c7ca2fa54e133e96ed1d1e64a93 (patch)
treeae90a31a32411fd90bb244a88f8bc5075ffcd534
parent28e2d41fa6a2ff9c2510887ef10243560fc3eb40 (diff)
downloadgcc-6cbe075be7489c7ca2fa54e133e96ed1d1e64a93.zip
gcc-6cbe075be7489c7ca2fa54e133e96ed1d1e64a93.tar.gz
gcc-6cbe075be7489c7ca2fa54e133e96ed1d1e64a93.tar.bz2
Move updated versioning threshold compute
The following moves computing the combined main + epilogue loop versioning threshold until we figured the epilogues to use rather than incrementally updating it with the chance to joust candidates after the fact. * tree-vect-loop.cc (vect_analyze_loop): Move lowest_th compute until after epilogue_vinfos is final.
-rw-r--r--gcc/tree-vect-loop.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index df89eda..7ed3a56 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -3691,7 +3691,6 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call,
return first_loop_vinfo;
/* Now analyze first_loop_vinfo for epilogue vectorization. */
- poly_uint64 lowest_th = LOOP_VINFO_VERSIONING_THRESHOLD (first_loop_vinfo);
/* For epilogues start the analysis from the first mode. The motivation
behind starting from the beginning comes from cases where the VECTOR_MODES
@@ -3750,16 +3749,7 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call,
}
/* For now only allow one epilogue loop. */
if (first_loop_vinfo->epilogue_vinfos.is_empty ())
- {
- first_loop_vinfo->epilogue_vinfos.safe_push (loop_vinfo);
- poly_uint64 th = LOOP_VINFO_VERSIONING_THRESHOLD (loop_vinfo);
- gcc_assert (!LOOP_REQUIRES_VERSIONING (loop_vinfo)
- || maybe_ne (lowest_th, 0U));
- /* Keep track of the known smallest versioning
- threshold. */
- if (ordered_p (lowest_th, th))
- lowest_th = ordered_min (lowest_th, th);
- }
+ first_loop_vinfo->epilogue_vinfos.safe_push (loop_vinfo);
else
{
delete loop_vinfo;
@@ -3780,6 +3770,17 @@ vect_analyze_loop (class loop *loop, gimple *loop_vectorized_call,
if (!first_loop_vinfo->epilogue_vinfos.is_empty ())
{
+ poly_uint64 lowest_th
+ = LOOP_VINFO_VERSIONING_THRESHOLD (first_loop_vinfo);
+ for (auto epilog_vinfo : first_loop_vinfo->epilogue_vinfos)
+ {
+ poly_uint64 th = LOOP_VINFO_VERSIONING_THRESHOLD (epilog_vinfo);
+ gcc_assert (!LOOP_REQUIRES_VERSIONING (epilog_vinfo)
+ || maybe_ne (lowest_th, 0U));
+ /* Keep track of the known smallest versioning threshold. */
+ if (ordered_p (lowest_th, th))
+ lowest_th = ordered_min (lowest_th, th);
+ }
LOOP_VINFO_VERSIONING_THRESHOLD (first_loop_vinfo) = lowest_th;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,