This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
Robert Dewar <dewar@gnat.com> writes:
> Zack Weinberg wrote:
>
>>> if (*p != 'a')
>>> *p = 'a';
>>>
>>>can be safely optimized into
>>> *p = 'a';
>
>> ... that is *not* an optimization; the cache behavior of the latter is
>> likely to be worse than the former.
>
> On many architectures it will be a win, especially if it avoids a
> midpredicted branch. Of *course* you only do this transformation
> if it improves things.
Right. I am a little worried that we are currently doing this
unconditionally, is all.
zw