[llvm] c219ebd - [ExecutionEngine] Avoid repeated hash lookups (NFC) (#109563)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 22 00:18:26 PDT 2024
Author: Kazu Hirata
Date: 2024-09-22T00:18:22-07:00
New Revision: c219ebd95750c0ad6768d28d7569389e6fbd0be1
URL: https://github.com/llvm/llvm-project/commit/c219ebd95750c0ad6768d28d7569389e6fbd0be1
DIFF: https://github.com/llvm/llvm-project/commit/c219ebd95750c0ad6768d28d7569389e6fbd0be1.diff
LOG: [ExecutionEngine] Avoid repeated hash lookups (NFC) (#109563)
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/DefineExternalSectionStartAndEndSymbols.h
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/DefineExternalSectionStartAndEndSymbols.h b/llvm/lib/ExecutionEngine/JITLink/DefineExternalSectionStartAndEndSymbols.h
index 4a492ee2f7d07b..49cfc5dec25bb5 100644
--- a/llvm/lib/ExecutionEngine/JITLink/DefineExternalSectionStartAndEndSymbols.h
+++ b/llvm/lib/ExecutionEngine/JITLink/DefineExternalSectionStartAndEndSymbols.h
@@ -71,10 +71,7 @@ class DefineExternalSectionStartAndEndSymbols {
private:
SectionRange &getSectionRange(Section &Sec) {
- auto I = SectionRanges.find(&Sec);
- if (I == SectionRanges.end())
- I = SectionRanges.insert(std::make_pair(&Sec, SectionRange(Sec))).first;
- return I->second;
+ return SectionRanges.try_emplace(&Sec, Sec).first->second;
}
DenseMap<Section *, SectionRange> SectionRanges;
More information about the llvm-commits
mailing list