This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Empty loop removal


Hello,

> On Thu, 30 Jun 2005, Zdenek Dvorak wrote:
> > this patch implements removal of finite empty loops.  Unlike the
> > previous version of the patch that worked by transfering information
> > about finiteness of the loop to DCE, this version removes the loops
> > directly.  This makes it safer and less likely to cause bugs, although
> > possibly a bit weaker; nevertheless, on the practical cases there should
> > be no difference.
> 
> Does the part on "``empty'' loops" in doc/trouble.texi need updating
> now?

sure. Like this?

Zdenek

Index: doc/trouble.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/trouble.texi,v
retrieving revision 1.30
diff -c -3 -p -r1.30 trouble.texi
*** doc/trouble.texi	8 Dec 2004 08:42:15 -0000	1.30
--- doc/trouble.texi	18 Jul 2005 09:11:23 -0000
*************** However, the rationale here is that opti
*** 1220,1233 ****
  cannot produce an empty one. This held for carefully written C compiled
  with less powerful optimizers but is not always the case for carefully
  written C++ or with more powerful optimizers.
- 
- @opindex funroll-loops
  Thus GCC will remove operations from loops whenever it can determine
  those operations are not externally visible (apart from the time taken
! to execute them, of course).  As GCC improves, it will remove the loop
! itself.  Indeed, with @option{-funroll-loops} small loops can already be
! removed, so leaving an empty non-unrolled loop is both sub-optimal and
! inconsistent.
  
  Be aware of this when performing timing tests, for instance the
  following loop can be completely removed, provided
--- 1220,1229 ----
  cannot produce an empty one. This held for carefully written C compiled
  with less powerful optimizers but is not always the case for carefully
  written C++ or with more powerful optimizers.
  Thus GCC will remove operations from loops whenever it can determine
  those operations are not externally visible (apart from the time taken
! to execute them, of course).  In case the loop can be proved to be finite,
! GCC will also remove the loop itself.
  
  Be aware of this when performing timing tests, for instance the
  following loop can be completely removed, provided


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]