aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-01-16 21:02:05 -0800
committerFangrui Song <i@maskray.me>2022-01-16 21:02:05 -0800
commite20544543478b259eb09fa0a253d4fb1a5525d9e (patch)
treee50f82a39f5577a49cf3ffb6c3190591b1bc12a1 /lld/ELF/SyntheticSections.cpp
parent427d3b93eebadb57ef72e1eb167dd41043b87f39 (diff)
downloadllvm-e20544543478b259eb09fa0a253d4fb1a5525d9e.zip
llvm-e20544543478b259eb09fa0a253d4fb1a5525d9e.tar.gz
llvm-e20544543478b259eb09fa0a253d4fb1a5525d9e.tar.bz2
[ELF] StringTableSection: Use DenseMap<CachedHashStringRef> to avoid redundant hash computation
5~6% speedup when linking clang and chrome.
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r--lld/ELF/SyntheticSections.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index aef6434..9944877 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1239,7 +1239,7 @@ StringTableSection::StringTableSection(StringRef name, bool dynamic)
// them with some other string that happens to be the same.
unsigned StringTableSection::addString(StringRef s, bool hashIt) {
if (hashIt) {
- auto r = stringMap.insert(std::make_pair(s, this->size));
+ auto r = stringMap.try_emplace(CachedHashStringRef(s), size);
if (!r.second)
return r.first->second;
}