Skip to content

Commit 78408fd

Browse files
[ExecutionEngine] Avoid repeated map lookups (NFC) (#131552)
1 parent 05607a3 commit 78408fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ class RuntimeDyldMachOAArch64
445445
(RE.Size == 2 || RE.Size == 3)) ||
446446
RE.Size == 2);
447447
SectionEntry &Section = Sections[RE.SectionID];
448-
StubMap::const_iterator i = Stubs.find(Value);
448+
auto [It, Inserted] = Stubs.try_emplace(Value);
449449
int64_t Offset;
450-
if (i != Stubs.end())
451-
Offset = static_cast<int64_t>(i->second);
450+
if (!Inserted)
451+
Offset = static_cast<int64_t>(It->second);
452452
else {
453453
// FIXME: There must be a better way to do this then to check and fix the
454454
// alignment every time!!!
@@ -458,7 +458,7 @@ class RuntimeDyldMachOAArch64
458458
(BaseAddress + Section.getStubOffset() + StubAlignment - 1) &
459459
-StubAlignment;
460460
unsigned StubOffset = StubAddress - BaseAddress;
461-
Stubs[Value] = StubOffset;
461+
It->second = StubOffset;
462462
assert(isAligned(getStubAlignment(), StubAddress) &&
463463
"GOT entry not aligned");
464464
RelocationEntry GOTRE(RE.SectionID, StubOffset,

0 commit comments

Comments
 (0)