This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] and question on loops state in the vectorizer





Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote on 20/02/2005
23:28:44:
> Hello,
>
> > > > (2) (question:) On entry to vectorization pass we assume that the
loop
> > > > state (entry/exit edges etc.) are up to date. i.e. - we don't call
> > > > flow_loop_scan on the loops before we analyze them. Is that a safe
> > > > assumption?
> > >
> > > No.
> > >
> >
> > In this case, we need the following patch (yet to be bootstrapped and
> > tested):
> >
> >       * tree-vectorizer.c (vectorize_loops): Call flow_loop_scan and
> >       verify_loop_structure.
>
> do you really use anything what is computed by flow_loop_scan?

maybe?. a quick scan of how we use entry_edges/exit_edges seems to show
that we always use them as entry_edges[0]/exit_edges[0], so this looks
promising (i.e, we probably could replace those with
loop_preheader/single_exit).

> If you
> do, you should not -- I would like to remove flow_loop_scan
> functionality soon.

are you trying to do that for 4.0?

>
> The reason is that we now have two sets of functions for common
> operations (geting loop preheader, exits, etc.).  One of them
> are the separate accessors, the other are structures filled in
> by flow_loop_scan.  While we always ensure that the information
> provided by the former is up-to-date, we nowhere bother to update
> the information gathered by flow_loop_scan, which makes it dangerous
> to use the later.
>
> Zdenek
>
> > Index: tree-vectorizer.c
> > ===================================================================
> > RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
> > retrieving revision 2.75
> > diff -c -3 -p -r2.75 tree-vectorizer.c
> > *** tree-vectorizer.c   17 Feb 2005 16:19:49 -0000      2.75
> > --- tree-vectorizer.c   20 Feb 2005 14:25:21 -0000
> > *************** vectorize_loops (struct loops *loops)
> > *** 1577,1582 ****
> > --- 1577,1593 ----
> >     verify_loop_closed_ssa ();
> >   #endif
> >
> > +
> > +   for (i = 1; i < loops->num; i++)
> > +     flow_loop_scan (loops->parray[i], LOOP_ALL);
> > +
> > + #ifdef ENABLE_CHECKING
> > +   gcc_assert (loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS);
> > +   gcc_assert (loops->state & LOOPS_HAVE_PREHEADERS);
> > +   gcc_assert (loops->state & LOOPS_HAVE_SIMPLE_LATCHES);
> > +   verify_loop_structure (loops);
> > + #endif
> > +
> >     compute_immediate_uses (TDFA_USE_OPS, need_imm_uses_for);
> >
> >     /*  ----------- Analyze loops. -----------  */
> >
> >
> > > > Also, I tested the following right at the entry to vectorize_loops:
> > > > + #ifdef ENABLE_CHECKING
> > > > +   gcc_assert (loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS);
> > > > +   gcc_assert (loops->state & LOOPS_HAVE_PREHEADERS);
> > > > +   gcc_assert (loops->state & LOOPS_HAVE_SIMPLE_LATCHES);
> > > > +   verify_loop_structure (loops);
> > > > + #endif
> > > > +
> > > > The above should hold right after loop init, but I wasn't able to
> > convince
> > > > myself that it's also guaranteed to be the case just before the
> > vectorizer.
> > > > These asserts do hold through SPEC and bootstrap with vectorization
> > enabled
> > > > FWIW. So the question is - is it safe to assume the above? ok to
add
> > these
> > > > asserts?
> > >
> > > Yes.  loops->state flags are never reset (except if you do it
> > > explicitly), and are checked in verify_loop_structure.
> > >
> >
> > thanks,
> >
> > dorit
> >
> >
> > > Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]