This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unrolling
- To: Stephen Williams <steve at icarus dot icarus dot com>
- Subject: Re: Loop unrolling
- From: Lee Iverson <leei at ai dot sri dot com>
- Date: Mon, 01 Jun 1998 14:24:15 -0700
- cc: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>, egcs at cygnus dot com
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