Skip to content

Commit fb9329c

Browse files
[ExecutionEngine] Avoid repeated hash lookups (NFC) (llvm#129822)
1 parent 88736f5 commit fb9329c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ class COFFLinkGraphLowering_x86_64 {
235235

236236
private:
237237
orc::ExecutorAddr getSectionStart(Section &Sec) {
238-
if (!SectionStartCache.count(&Sec)) {
238+
auto [It, Inserted] = SectionStartCache.try_emplace(&Sec);
239+
if (Inserted) {
239240
SectionRange Range(Sec);
240-
SectionStartCache[&Sec] = Range.getStart();
241-
return Range.getStart();
241+
It->second = Range.getStart();
242242
}
243-
return SectionStartCache[&Sec];
243+
return It->second;
244244
}
245245

246246
GetImageBaseSymbol GetImageBase;

0 commit comments

Comments
 (0)