This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Empty loop elimination in 4.0 ?
On Jan 10, 2005, at 9:25 AM, Robert Dewar wrote:
Andrew Pinski wrote:
Or even in C now a days with all the optimizations we could do like
converting some loops to memset which still keeps the loop because it
is
ideal to have later passes delete the loop.
A loop converted to memset is not an empty loop! Can you give
some other example to show what you mean. to me if a loop ends
up empty, it is always a case to warn the programmer about.
This:
int *f;
int i;
for (i=0;i<10;i++)
f[i] = 0;
will be converted to:
memset (f, 0, i * sizeof(*f));
for (i=0;i<10;i++)
;
So we end up with an empty loop which then is removed by a later pass.
This is normal thing to do is have later passes remove junk. The
pass which does this transformation has no business in acting as
loop DCE.
-- Pinski