diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index 9dc1a0d0b4678..39451c3d64870 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -178,10 +178,7 @@ void InstrProfWriter::overlapRecord(NamedInstrProfRecord &&Other, return; } auto &ProfileDataMap = It->second; - bool NewFunc; - ProfilingData::iterator Where; - std::tie(Where, NewFunc) = - ProfileDataMap.insert(std::make_pair(Hash, InstrProfRecord())); + auto [Where, NewFunc] = ProfileDataMap.try_emplace(Hash); if (NewFunc) { Overlap.addOneMismatch(FuncLevelOverlap.Test); return; @@ -200,10 +197,7 @@ void InstrProfWriter::addRecord(StringRef Name, uint64_t Hash, function_ref Warn) { auto &ProfileDataMap = FunctionData[Name]; - bool NewFunc; - ProfilingData::iterator Where; - std::tie(Where, NewFunc) = - ProfileDataMap.insert(std::make_pair(Hash, InstrProfRecord())); + auto [Where, NewFunc] = ProfileDataMap.try_emplace(Hash); InstrProfRecord &Dest = Where->second; auto MapWarn = [&](instrprof_error E) {