This is the mail archive of the gcc@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]

Re: Loop unrolling


In message <199806011514.IAA02191@icarus.icarus.com> you write:
> 
> pfeifer@dbai.tuwien.ac.at said:
> > As a matter of fact, is there still any strong reason not to delete
> > empty loops in general? 
> 
> As a matter of fact, there is. Us embedded programmers are sometimes
> compelled to write timing loops. I guess we should (and I usually do)
> make those loops non-empty, but still ....

But the correct way to write an empty loop that shouldn't be deleted
(a timing loop) already exists:

	{
	  volatile int i;
	  for (i = 0; i < 10000; ++i);
	}

As is stands now, deleting empty loops is a very desirable *feature*,
especially for higher-level languages like C++ and Java which may just
generate loops that the programmer doesn't see.  If anything, we need
to expand the detection and deletion of empty loops.  A couple of us
embarked on this exercise for a couple of weeks last summer, but the
lack of register lifetime information in the loop optimization pass
bit us badly.  Maybe its time to resurrect this old code and make it
work?

-------------------------------------------------------------------------------
Lee Iverson     		SRI International
leei@ai.sri.com			333 Ravenswood Ave., Menlo Park CA 94025
http://www.ai.sri.com/~leei/	(650) 859-3307



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