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: Builtin expansion versus headers optimization: Reductions


OndÅej BÃlka <neleai@seznam.cz> writes:

> As I commented on libc-alpha list that for string functions a header
> expansion is better than builtins from maintainance perspective and also
> that a header is lot easier to write and review than doing that in gcc
> Jeff said that it belongs to gcc. When I asked about benefits he
> couldn't say any so I ask again where are benefits of that?

It definitely has disadvantages in headers. Just today I was prevented
from setting a conditional break point with strcmp in gdb because
it expanded to a macro including __extension__ which gdb doesn't
understand.

The compiler has much more information than the headers.

- It can do alias analysis, so to avoid needing to handle overlap
and similar.
- It can (sometimes) determine alignment, which is important
information for tuning.
- With profile feedback it can use value histograms to determine the
best code.

It may not use all of this today, but it could.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only


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