On Wed, 8 Apr 2009, Richard Guenther wrote:

> On Wed, 8 Apr 2009, Jan Hubicka wrote:
> >   - The nature of code duplication in between cleanup at end of block and
> >     cleanup in EH actually brings a lot of tail merging possibilities.
> >     I wonder if we can handle this somehow effectivly on SSA. In RTL world
> >     crossjumping would catch thse cases if it was not almost 100% 
> > ineffective
> >     by fact that we hardly re-use same register for temporaries.
> > 
> >     I wonder if there is resonable SSA optimization that would have similar
> >     effect as tail merging here or if we want to implement tail merging on
> >     gimple.
> >   - Can we somehow conclude that structure being desturcted dies after the
> >     destructors so all writes to it are dead already in early optimizations?
> >     That would allow a lot more DSE and cheaper inlining.
> >   - It is possible to make EH edges redirectable on RTL too.  I wonder
> >     if it is worth the effort however.
> >   - We ought to be able to prove finitarity of simple loops so we can
> >     DCE more early and won't rely on full loop unrolling to get rid of
> >     empty loops originally initializing dead arrays.
> 
> I wonder if CD-DCE should not catch this, but I see that for
> 
>  for(i=0;i<4;++i)
>    ;
> 
> we do
> 
> Marking useful stmt: if (i_1 <= 3)
> 
> which is already a problem if we want to DCE the loop.  Can we
> mark the controlling predicate necessary somehow only if we
> mark a stmt necessary in the BBs it controls?

Ah, it can do it but ...

      /* Prevent the loops from being removed.  We must keep the infinite 
loops,
         and we currently do not have a means to recognize the finite 
ones.  */
      FOR_EACH_BB (bb)
        {
          edge_iterator ei;
          FOR_EACH_EDGE (e, ei, bb->succs)
            if (e->flags & EDGE_DFS_BACK)
              mark_control_dependent_edges_necessary (e->dest, el);
        }

thus what we could do is initialize loops and use number of iterations
analysis here and mark only the back edge of those we do not know
the number of iterations.  Of course that is both expensive.

Richard.

Reply via email to