Skip to content

Commit 16aa400

Browse files
[ELF] Avoid repeated hash lookups (NFC) (#122628)
1 parent fd87188 commit 16aa400

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lld/ELF/Arch/ARM.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,8 +1320,9 @@ void elf::processArmCmseSymbols(Ctx &ctx) {
13201320
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
13211321
for (size_t i = 0, e = syms.size(); i != e; ++i) {
13221322
StringRef symName = syms[i]->getName();
1323-
if (ctx.symtab->cmseSymMap.count(symName))
1324-
syms[i] = ctx.symtab->cmseSymMap[symName].acleSeSym;
1323+
auto it = ctx.symtab->cmseSymMap.find(symName);
1324+
if (it != ctx.symtab->cmseSymMap.end())
1325+
syms[i] = it->second.acleSeSym;
13251326
}
13261327
});
13271328
}
@@ -1370,8 +1371,9 @@ void ArmCmseSGSection::addSGVeneer(Symbol *acleSeSym, Symbol *sym) {
13701371
// Only secure symbols with values equal to that of it's non-secure
13711372
// counterpart needs to be in the .gnu.sgstubs section.
13721373
std::unique_ptr<ArmCmseSGVeneer> ss;
1373-
if (ctx.symtab->cmseImportLib.count(sym->getName())) {
1374-
Defined *impSym = ctx.symtab->cmseImportLib[sym->getName()];
1374+
auto it = ctx.symtab->cmseImportLib.find(sym->getName());
1375+
if (it != ctx.symtab->cmseImportLib.end()) {
1376+
Defined *impSym = it->second;
13751377
ss = std::make_unique<ArmCmseSGVeneer>(sym, acleSeSym, impSym->value);
13761378
} else {
13771379
ss = std::make_unique<ArmCmseSGVeneer>(sym, acleSeSym);

0 commit comments

Comments
 (0)