On Fri, 15 Nov 2024, Alex Coplan wrote:

> On 29/10/2024 13:41, Richard Biener wrote:
> > On Mon, 28 Oct 2024, Alex Coplan wrote:
> > 
> > > From: Tamar Christina <tamar.christ...@arm.com>
> > > 
> > > The alignment peeling changes exposed a latent missing dominator update
> > > with early break vectorization, specifically when inserting the vector
> > > skip edge, since the new edge bypasses the prolog skip block and thus
> > > has the potential to subvert its dominance.  This patch fixes that.
> > 
> > OK.
> 
> Thanks.  Regular (-O2) bootstrap on aarch64-linux-gnu showed this
> triggers -Wmaybe-uninitialized due to the new use of the prolog variable
> (which I think is a false positive, since it's guarded by
> prolog_peeling).  The attached version works around it by initializing
> prolog to NULL.  Incrementally, that's:
> 
> diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
> index 1dcb0b427f0..f98c162fc0a 100644
> --- a/gcc/tree-vect-loop-manip.cc
> +++ b/gcc/tree-vect-loop-manip.cc
> @@ -3198,7 +3198,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, 
> tree nitersm1,
>    prob_prolog = prob_epilog = profile_probability::guessed_always ()
>                       .apply_scale (estimated_vf - 1, estimated_vf);
>  
> -  class loop *prolog, *epilog = NULL;
> +  class loop *prolog = NULL, *epilog = NULL;
>    class loop *first_loop = loop;
>    bool irred_flag = loop_preheader_edge (loop)->flags & 
> EDGE_IRREDUCIBLE_LOOP;
>  
> I guess the incremental change should be obvious, but just to check you're 
> happy
> with the workaround, is the updated version OK?

Sure.

> Alex
> 
> > 
> > Thanks,
> > Richard.
> > 
> > > gcc/ChangeLog:
> > > 
> > >   * tree-vect-loop-manip.cc (vect_do_peeling): Update immediate
> > >   dominators of nodes that were dominated by the prolog skip block
> > >   after inserting vector skip edge.
> > > 
> > > gcc/testsuite/ChangeLog:
> > > 
> > >   * g++.dg/vect/vect-early-break_6.cc: New test.
> > > 
> > > Co-Authored-By: Alex Coplan <alex.cop...@arm.com>
> > > ---
> > >  .../g++.dg/vect/vect-early-break_6.cc         | 25 +++++++++++++++++++
> > >  gcc/tree-vect-loop-manip.cc                   | 24 ++++++++++++++++++
> > >  2 files changed, 49 insertions(+)
> > >  create mode 100644 gcc/testsuite/g++.dg/vect/vect-early-break_6.cc
> > > 
> > > 
> > 
> > -- 
> > Richard Biener <rguent...@suse.de>
> > SUSE Software Solutions Germany GmbH,
> > Frankenstrasse 146, 90461 Nuernberg, Germany;
> > GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to