Skip to content

Commit 51b288d

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#140838)
1 parent adbe155 commit 51b288d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/CodeGen/StackMaps.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,9 @@ void StackMaps::recordStackMapOpers(const MCSymbol &MILabel,
521521
MFI.hasVarSizedObjects() || RegInfo->hasStackRealignment(*(AP.MF));
522522
uint64_t FrameSize = HasDynamicFrameSize ? UINT64_MAX : MFI.getStackSize();
523523

524-
auto CurrentIt = FnInfos.find(AP.CurrentFnSym);
525-
if (CurrentIt != FnInfos.end())
524+
auto [CurrentIt, Inserted] = FnInfos.try_emplace(AP.CurrentFnSym, FrameSize);
525+
if (!Inserted)
526526
CurrentIt->second.RecordCount++;
527-
else
528-
FnInfos.insert(std::make_pair(AP.CurrentFnSym, FunctionInfo(FrameSize)));
529527
}
530528

531529
void StackMaps::recordStackMap(const MCSymbol &L, const MachineInstr &MI) {

0 commit comments

Comments
 (0)