diff --git a/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp index 8ceb08051e423..30718bae15565 100644 --- a/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp @@ -235,12 +235,12 @@ class COFFLinkGraphLowering_x86_64 { private: orc::ExecutorAddr getSectionStart(Section &Sec) { - if (!SectionStartCache.count(&Sec)) { + auto [It, Inserted] = SectionStartCache.try_emplace(&Sec); + if (Inserted) { SectionRange Range(Sec); - SectionStartCache[&Sec] = Range.getStart(); - return Range.getStart(); + It->second = Range.getStart(); } - return SectionStartCache[&Sec]; + return It->second; } GetImageBaseSymbol GetImageBase;