Skip to content

Commit 178fb96

Browse files
[ExecutionEngine] Avoid repeated hash lookups (NFC) (#129466)
1 parent 9805854 commit 178fb96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,17 +682,17 @@ void RuntimeDyldELF::resolveLoongArch64Branch(unsigned SectionID,
682682
uint64_t Offset = RelI->getOffset();
683683
unsigned RelType = RelI->getType();
684684
// Look for an existing stub.
685-
StubMap::const_iterator i = Stubs.find(Value);
686-
if (i != Stubs.end()) {
685+
auto [It, Inserted] = Stubs.try_emplace(Value);
686+
if (!Inserted) {
687687
resolveRelocation(Section, Offset,
688-
(uint64_t)Section.getAddressWithOffset(i->second),
688+
(uint64_t)Section.getAddressWithOffset(It->second),
689689
RelType, 0);
690690
LLVM_DEBUG(dbgs() << " Stub function found\n");
691691
return;
692692
}
693693
// Create a new stub function.
694694
LLVM_DEBUG(dbgs() << " Create a new stub function\n");
695-
Stubs[Value] = Section.getStubOffset();
695+
It->second = Section.getStubOffset();
696696
uint8_t *StubTargetAddr =
697697
createStubFunction(Section.getAddressWithOffset(Section.getStubOffset()));
698698
RelocationEntry LU12I_W(SectionID, StubTargetAddr - Section.getAddress(),

0 commit comments

Comments
 (0)