Graphite review, graphite parts [1/n]

Richard Guenther rguenther@suse.de
Fri Aug 22 09:52:00 GMT 2008


On Thu, 21 Aug 2008, Sebastian Pop wrote:

> > +/* Scan the loops and remove the ones that have been marked for
> > +   removal.  */
> > +
> > +static void
> > +remove_dead_loops (void)
> > +{
> > +  struct loop *loop, *ploop;
> > +  loop_iterator li;
> > +
> > +  FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
> > +    {
> > +      if (loop->header)
> > +	continue;
> > +
> > +      while (loop->inner)
> > +	{
> > +	  ploop = loop->inner;
> > +	  flow_loop_tree_node_remove (ploop);
> > +	  flow_loop_tree_node_add (loop_outer (loop), ploop);
> > +	}
> > +
> > +      /* Remove the loop and free its data.  */
> > +      delete_loop (loop);
> > +    }
> >
> > I don't see how loops are not marked.  This seems to remove _all_
> > loops.  The while (loop->inner) loop must be dead - how can an
> > outer loop be deleted without deleting its inner loops??
> 
> The loops to be deleted are marked with this function:
> 
> /* Mark the original loops of SCOP for removal, replacing their header
>    field with NULL.  */
> 
> static void
> mark_old_loops (scop_p scop)
> {
>   int i;
>   struct loop *loop;
> 
>   for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, loop); i++)
>     {
>       loop->header = NULL;
>       loop->latch = NULL;
>     }
> }
> 
> Then the delete_loop removes only those loops, i.e. only the original
> loops of the scop.

Ok, I see.  A comment explaining this and refering to mark_old_loops
for remove_dead_loops would be nice.

Thanks,
Richard.



More information about the Gcc-patches mailing list