[tree-ssa] Dce & infinite loops

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Thu Mar 18 16:26:00 GMT 2004


Hello,

> > > It is important to remove loops that are empty, but can be shown
> > > to terminate. Even though programmers may not write such code,
> > > other optimizations may make all code invariant, resulting in an
> > > empty loop.
> > 
> > how often this happens? More precisely, could I see at least one
> > real-world example?
> 
> See the previous discussions that resulted in the change to the section of
> the manual explaining why we didn't remove empty loops, e.g.
> <http://gcc.gnu.org/ml/gcc/1998-05/msg00651.html> and thread,
> <http://gcc.gnu.org/ml/gcc/1998-06/msg00011.html> and (long) thread.  For
> example, the example in <http://gcc.gnu.org/ml/gcc/1998-06/msg00089.html>
> generates an empty loop just as it did in 1998, and the threads have other
> examples.

OK, I may easily extend the loop optimizer to remove empty loops if
there is a demand for it (once dce is fixed so that it is not done
even in cases it is incorrect, as happens now).

Zdenek



More information about the Gcc mailing list