This is the mail archive of the
mailing list for the GCC project.
Re: Builtin expansion versus headers optimization: Reductions
- From: Andi Kleen <andi at firstfloor dot org>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: gcc at gcc dot gnu dot org, law at redhat dot org, libc-alpha at sourceware dot org
- Date: Thu, 04 Jun 2015 14:34:40 -0700
- Subject: Re: Builtin expansion versus headers optimization: Reductions
- Authentication-results: sourceware.org; auth=none
- References: <20150604105929 dot GA19141 at domone>
OndÅej BÃlka <firstname.lastname@example.org> 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
The compiler has much more information than the headers.
- It can do alias analysis, so to avoid needing to handle overlap
- It can (sometimes) determine alignment, which is important
information for tuning.
- With profile feedback it can use value histograms to determine the
It may not use all of this today, but it could.
email@example.com -- Speaking for myself only