diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebugInfoSupport.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebugInfoSupport.cpp index 5a058bd712a3e..9b842180fa7a7 100644 --- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebugInfoSupport.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebugInfoSupport.cpp @@ -33,10 +33,9 @@ static DenseSet DWARFSectionNames = { static void preserveDWARFSection(LinkGraph &G, Section &Sec) { DenseMap Preserved; for (auto Sym : Sec.symbols()) { - if (Sym->isLive()) - Preserved[&Sym->getBlock()] = Sym; - else if (!Preserved.count(&Sym->getBlock())) - Preserved[&Sym->getBlock()] = Sym; + auto [It, Inserted] = Preserved.try_emplace(&Sym->getBlock()); + if (Inserted || Sym->isLive()) + It->second = Sym; } for (auto Block : Sec.blocks()) { auto &PSym = Preserved[Block];