> > >   * f95-lang.c (gfc_init_builtin_functions): Build __builtin_unreachable.
> > 
> > I wonder if other languages need similar adjustment?
> 
> I also wondered ;) Only Fortran triggered, I will take a look.
> > 
> > +  /* Now destroy the loop.  First try to do so by cancelling the
> > +     patch from exit conditional if we identified good candidate.
> > +
> > 
> > you mean 'path' here, right?  Similar in other places.
> 
> Yeah.
> > 
> > +      /* Unloop destroys the latch edge.  */
> > +      unloop (loop, &irred_invalidated);
> > +      if (irred_invalidated)
> > +       mark_irreducible_loops ();
> > 
> > this makes the whole thing quadratic in the number of loops.
> > Please pass down a flag and handle this in the place we
> > update SSA form (thus, once per function / unroll iteration).
> 
> This was in my first version of the patch. Then I noticed that remove_path
> also relies on irreducible loops to be computed and does the exactly same
> logic as I do.
> So we would need to extend the &irred_invalidated to remove_path as well.

Actually thinking about it, I perhaps can just split the loopback edge and
output there the unreachable call letting cfgcleanup to do all the hard work.
In a way I like it better when the complette unroller cancels the loops
and has chance to cascade, but the cascading needs SSA update and cleanup of
unneeded PHI nodes anyway.

Honza

Reply via email to