Skip to content

Commit 8c2714e

Browse files
[ExecutionEngine] Avoid repeated hash lookups (NFC) (#130707)
1 parent 21f1ef3 commit 8c2714e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/ExecutionEngine/Orc/Debugging/DebugInfoSupport.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ static DenseSet<StringRef> DWARFSectionNames = {
3333
static void preserveDWARFSection(LinkGraph &G, Section &Sec) {
3434
DenseMap<Block *, Symbol *> Preserved;
3535
for (auto Sym : Sec.symbols()) {
36-
if (Sym->isLive())
37-
Preserved[&Sym->getBlock()] = Sym;
38-
else if (!Preserved.count(&Sym->getBlock()))
39-
Preserved[&Sym->getBlock()] = Sym;
36+
auto [It, Inserted] = Preserved.try_emplace(&Sym->getBlock());
37+
if (Inserted || Sym->isLive())
38+
It->second = Sym;
4039
}
4140
for (auto Block : Sec.blocks()) {
4241
auto &PSym = Preserved[Block];

0 commit comments

Comments
 (0)