[llvm] 11c6ea3 - [ExecutionEngine] Avoid repeated hash lookups (NFC) (#111275)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 6 09:22:30 PDT 2024
Author: Kazu Hirata
Date: 2024-10-06T09:22:27-07:00
New Revision: 11c6ea3d3bd59c548562425f0de1fcef1b4660dc
URL: https://github.com/llvm/llvm-project/commit/11c6ea3d3bd59c548562425f0de1fcef1b4660dc
DIFF: https://github.com/llvm/llvm-project/commit/11c6ea3d3bd59c548562425f0de1fcef1b4660dc.diff
LOG: [ExecutionEngine] Avoid repeated hash lookups (NFC) (#111275)
Added:
Modified:
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 92f37c22ae5132..25b76c7668350b 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -1610,13 +1610,10 @@ RuntimeDyldELF::processRelocationRef(
RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
if (r_type == ELF::R_MIPS_CALL16 || r_type == ELF::R_MIPS_GOT_PAGE
|| r_type == ELF::R_MIPS_GOT_DISP) {
- StringMap<uint64_t>::iterator i = GOTSymbolOffsets.find(TargetName);
- if (i != GOTSymbolOffsets.end())
- RE.SymOffset = i->second;
- else {
- RE.SymOffset = allocateGOTEntries(1);
- GOTSymbolOffsets[TargetName] = RE.SymOffset;
- }
+ auto [I, Inserted] = GOTSymbolOffsets.try_emplace(TargetName);
+ if (Inserted)
+ I->second = allocateGOTEntries(1);
+ RE.SymOffset = I->second;
if (Value.SymbolName)
addRelocationForSymbol(RE, Value.SymbolName);
else
More information about the llvm-commits
mailing list