[llvm-ifs] Avoid repeated map lookups (NFC) (#109750)

This commit is contained in:
Kazu Hirata
2024-09-24 16:40:54 -07:00
committed by GitHub
parent 2f9c9ff789
commit 4c3fccdd88

View File

@@ -441,12 +441,9 @@ int llvm_ifs_main(int argc, char **argv, const llvm::ToolContext &) {
}
for (auto Symbol : TargetStub->Symbols) {
auto SI = SymbolMap.find(Symbol.Name);
if (SI == SymbolMap.end()) {
SymbolMap.insert(
std::pair<std::string, IFSSymbol>(Symbol.Name, Symbol));
auto [SI, Inserted] = SymbolMap.try_emplace(Symbol.Name, Symbol);
if (Inserted)
continue;
}
assert(Symbol.Name == SI->second.Name && "Symbol Names Must Match.");