[ADT] Apply a large hammer to StringRef functions: attribute always_inline.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 10 Sep 2015 08:29:35 +0000 (08:29 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 10 Sep 2015 08:29:35 +0000 (08:29 +0000)
commit3dba3be8e521318a6d3000baaf1ce9c458c915f6
tree52ecea1bc264294c9af7bcd4c3108100306e9b4f
parentcfffa6e06aabd5cea3f9ab8d31517bfc42fb365c
[ADT] Apply a large hammer to StringRef functions: attribute always_inline.

The logic of this follows something Howard does in libc++ and something
I discussed with Chris eons ago -- for a lot of functions, there is
really no benefit to preserving "debug information" by leaving the
out-of-line even in debug builds. This is especially true as we now do
a very good job of preserving most debug information even in the face of
inlining. There are a bunch of methods in StringRef that we are paying
a completely unacceptable amount for with every debug build of every
LLVM developer.

Some day, we should fix Clang/LLVM so that developers can reasonable
use a default of something other than '-O0' and not waste their lives
waiting on *completely* unoptimized code to execute. We should have
a default that doesn't impede debugging while providing at least
plausable performance.

But today is not that day.

So today, I'm applying always_inline to the functions that are really
hurting the critical path for stuff like 'check_llvm'. I'm being very
cautious here, but there are a few other APIs that we really should do
this for as a matter of pragmatism. Hopefully we can rip this out some
day.

With this change, TripleTest.Normalization runtime decreases by over
10%, and the total 'check-llvm' time on my 48-core box goes from 38s to
just under 37s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247253 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/StringRef.h