[PATCH] Don't reapply loops flags if unnecessary in loop_optimizer_init

Richard Biener rguenther@suse.de
Mon Nov 23 10:33:00 GMT 2015


On Mon, 23 Nov 2015, Tom de Vries wrote:

> [ was: Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def ]
> 
> On 20/11/15 11:37, Richard Biener wrote:
> > I'd rather make loop_optimizer_init do nothing
> > if requested flags are already set and no fixup is needed and
> > call the above unconditionally.  Thus sth like
> > 
> > Index: gcc/loop-init.c
> > ===================================================================
> > --- gcc/loop-init.c     (revision 230649)
> > +++ gcc/loop-init.c     (working copy)
> > @@ -103,7 +103,11 @@ loop_optimizer_init (unsigned flags)
> >         calculate_dominance_info (CDI_DOMINATORS);
> > 
> >         if (!needs_fixup)
> > -       checking_verify_loop_structure ();
> > +       {
> > +         checking_verify_loop_structure ();
> > +         if (loops_state_satisfies_p (flags))
> > +           goto out;
> > +       }
> > 
> >         /* Clear all flags.  */
> >         if (recorded_exits)
> > @@ -122,11 +126,12 @@ loop_optimizer_init (unsigned flags)
> >     /* Apply flags to loops.  */
> >     apply_loop_flags (flags);
> > 
> > +  checking_verify_loop_structure ();
> > +
> > +out:
> >     /* Dump loops.  */
> >     flow_loops_dump (dump_file, NULL, 1);
> > 
> > -  checking_verify_loop_structure ();
> > -
> >     timevar_pop (TV_LOOP_INIT);
> >   }
> 
> This patch implements that approach, but the patch is slightly more
> complicated because of the need to handle LOOPS_MAY_HAVE_MULTIPLE_LATCHES
> differently than the rest of the flags.
> 
> Bootstrapped and reg-tested on x86_64.
> 
> OK for stage3 trunk?

Let's revisit this during stage1 if the scev_initialized () thing
SLP vectorization uses works, ok?

Thanks,
Richard.

> Thanks,
> - Tom
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)



More information about the Gcc-patches mailing list