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]
Other format: [Raw text]

Re: Empty loop elimination in 4.0 ?



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


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