[patch] and question on loops state in the vectorizer

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Mon Feb 21 10:05:00 GMT 2005


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?  If you
do, you should not -- I would like to remove flow_loop_scan
functionality soon.

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



More information about the Gcc-patches mailing list