This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
Jonathan Lennox <lennox@cs.columbia.edu> writes:
>> ... that is *not* an optimization; the cache behavior of the latter is
>> likely to be worse than the former.
>
> I was referencing the behavior of if-conversion which Roger Sayle described
> in <http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01271.html>. As I
> mentioned, the code's in GCC already.
>
> I don't know much about the logic of if-conversion, but presumably GCC only
> does this transformation if it's a general win?
It depends on the hardware, actually. The situation that I know of,
where it was a huge lose, involved a multiprocessor box and a shared
data structure being updated on both CPUs. Writing the value that
was already there caused the cache line to get bounced back and forth
between the caches.
zw