public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/tnfchris/heads/gcc-14-early-break)] middle-end: wire through peeling changes and dominator updates after guard edge split
@ 2023-11-15 14:55 Tamar Christina
0 siblings, 0 replies; only message in thread
From: Tamar Christina @ 2023-11-15 14:55 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3e9f01b8662513dfa89cb2007359fff148110830
commit 3e9f01b8662513dfa89cb2007359fff148110830
Author: Tamar Christina <tamar.christina@arm.com>
Date: Thu Nov 2 17:00:25 2023 +0000
middle-end: wire through peeling changes and dominator updates after guard edge split
Diff:
---
gcc/tree-vect-loop-manip.cc | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index e1d210ab461..44f70965528 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3321,11 +3321,14 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
epilog = vect_epilogues ? get_loop_copy (loop) : scalar_loop;
edge epilog_e = vect_epilogues ? e : scalar_e;
edge new_epilog_e = NULL;
- epilog = slpeel_tree_duplicate_loop_to_edge_cfg (loop, e, epilog,
- epilog_e, e,
- &new_epilog_e);
+ auto_vec<basic_block> doms;
+ epilog
+ = slpeel_tree_duplicate_loop_to_edge_cfg (loop, e, epilog, epilog_e, e,
+ &new_epilog_e, true, &doms);
+
LOOP_VINFO_EPILOGUE_IV_EXIT (loop_vinfo) = new_epilog_e;
gcc_assert (epilog);
+ gcc_assert (new_epilog_e);
epilog->force_vectorize = false;
bb_before_epilog = loop_preheader_edge (epilog)->src;
@@ -3424,10 +3427,16 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
exit, true);
}
- if (skip_epilog)
+ if (skip_epilog || LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
{
- guard_cond = fold_build2 (EQ_EXPR, boolean_type_node,
+ /* For the case where a different exit was chosen we must execute
+ the scalar loop with the remaining iterations. */
+ if (inversed_iv)
+ guard_cond = boolean_false_node;
+ else
+ guard_cond = fold_build2 (EQ_EXPR, boolean_type_node,
niters, niters_vector_mult_vf);
+
guard_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest;
edge epilog_e = LOOP_VINFO_EPILOGUE_IV_EXIT (loop_vinfo);
guard_to = epilog_e->dest;
@@ -3435,6 +3444,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
skip_vector ? anchor : guard_bb,
prob_epilog.invert (),
irred_flag);
+ doms.safe_push (guard_to);
if (vect_epilogues)
epilogue_vinfo->skip_this_loop_edge = guard_e;
edge main_iv = LOOP_VINFO_IV_EXIT (loop_vinfo);
@@ -3473,6 +3483,10 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
scale_loop_profile (epilog, prob_epilog, -1);
}
+ /* Recalculate the dominators after adding the guard edge. */
+ if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
+ iterate_fix_dominators (CDI_DOMINATORS, doms, false);
+
unsigned HOST_WIDE_INT bound;
if (bound_scalar.is_constant (&bound))
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-15 14:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 14:55 [gcc(refs/users/tnfchris/heads/gcc-14-early-break)] middle-end: wire through peeling changes and dominator updates after guard edge split Tamar Christina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).