Empty loop elimination in 4.0 ?
Andrew Pinski
pinskia@physics.uc.edu
Tue Jan 11 20:06:00 GMT 2005
On Jan 11, 2005, at 2:13 PM, Luca Benini wrote:
>> 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++)
>> ;
> ....but
>
> for (i=0;i<10;i++)
> f[i] = x;
>
> can't be converted in
>
> memset (f, x, i * sizeof(*f));
>
> for every x.
Yes I know that :)
We can convert it if the sizeof(*f) is 1 or if f is a pattern
which can converted for use with memset. The reason why I said 0 is
because that is the most common place where people should/could be using
memset.
-- Pinski
More information about the Gcc
mailing list