forked from OSchip/llvm-project
[ELF] Use llvm::toLower instead of libc call tolower
tolower() has some overhead because current locale is considered (though in lld the default "C" locale is used which does not matter too much). llvm::toLower is more efficient as it compiles to a compare and a conditional jump, as opposed to a libc call if tolower is used. Disregarding locale also matches gdb's behavior (gdb/minsyms.h): #define SYMBOL_HASH_NEXT(hash, c) \ ((hash) * 67 + TOLOWER ((unsigned char) (c)) - 113) where TOLOWER (include/safe-ctype.h) is a macro that uses a lookup table under the hood which is similar to llvm::toLower. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D52128 llvm-svn: 342342
This commit is contained in:
parent
70c5f9dff8
commit
3e0a54e9da
|
@ -30,6 +30,7 @@
|
|||
#include "lld/Common/Threads.h"
|
||||
#include "lld/Common/Version.h"
|
||||
#include "llvm/ADT/SetOperations.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
|
||||
#include "llvm/Object/Decompressor.h"
|
||||
|
@ -2338,7 +2339,7 @@ unsigned PltSection::getPltRelocOff() const {
|
|||
static uint32_t computeGdbHash(StringRef S) {
|
||||
uint32_t H = 0;
|
||||
for (uint8_t C : S)
|
||||
H = H * 67 + tolower(C) - 113;
|
||||
H = H * 67 + toLower(C) - 113;
|
||||
return H;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue