diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -349,7 +349,7 @@ }; using SortedCallTargetSet = std::set; - using CallTargetMap = StringMap; + using CallTargetMap = std::map; SampleRecord() = default; /// Increment the number of samples for this record by \p S. @@ -1040,10 +1040,10 @@ // profile annotation cannot be done until backend compilation in ThinLTO. for (const auto &BS : BodySamples) for (const auto &TS : BS.second.getCallTargets()) - if (TS.getValue() > Threshold) { - const Function *Callee = SymbolMap.lookup(getFuncName(TS.getKey())); + if (TS.second > Threshold) { + const Function *Callee = SymbolMap.lookup(getFuncName(TS.first)); if (isDeclaration(Callee)) - S.insert(getGUID(TS.getKey())); + S.insert(getGUID(TS.first)); } for (const auto &CS : CallsiteSamples) for (const auto &NameFS : CS.second) diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp --- a/llvm/lib/ProfileData/SampleProf.cpp +++ b/llvm/lib/ProfileData/SampleProf.cpp @@ -121,7 +121,7 @@ sampleprof_error Result; Result = addSamples(Other.getSamples(), Weight); for (const auto &I : Other.getCallTargets()) { - MergeResult(Result, addCalledTarget(I.first(), I.second, Weight)); + MergeResult(Result, addCalledTarget(I.first, I.second, Weight)); } return Result; } @@ -272,7 +272,7 @@ NameSet.insert(getName()); for (const auto &BS : BodySamples) for (const auto &TS : BS.second.getCallTargets()) - NameSet.insert(TS.getKey()); + NameSet.insert(TS.first); for (const auto &CS : CallsiteSamples) { for (const auto &NameFS : CS.second) { diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp --- a/llvm/lib/ProfileData/SampleProfWriter.cpp +++ b/llvm/lib/ProfileData/SampleProfWriter.cpp @@ -655,7 +655,7 @@ for (const auto &I : S.getBodySamples()) { const SampleRecord &Sample = I.second; for (const auto &J : Sample.getCallTargets()) - addName(J.first()); + addName(J.first); } // Recursively add all the names for inlined callsites. diff --git a/llvm/lib/Target/X86/X86InsertPrefetch.cpp b/llvm/lib/Target/X86/X86InsertPrefetch.cpp --- a/llvm/lib/Target/X86/X86InsertPrefetch.cpp +++ b/llvm/lib/Target/X86/X86InsertPrefetch.cpp @@ -125,7 +125,7 @@ // Convert serialized prefetch hints into PrefetchInfo objects, and populate // the Prefetches vector. for (const auto &S_V : *T) { - StringRef Name = S_V.getKey(); + StringRef Name = S_V.first; if (Name.consume_front(SerializedPrefetchPrefix)) { int64_t D = static_cast(S_V.second); unsigned IID = 0; diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -1083,11 +1083,11 @@ // profile annotation cannot be done until backend compilation in ThinLTO. for (const auto &BS : CalleeSample->getBodySamples()) for (const auto &TS : BS.second.getCallTargets()) - if (TS.getValue() > Threshold) { - StringRef CalleeName = CalleeSample->getFuncName(TS.getKey()); + if (TS.second > Threshold) { + StringRef CalleeName = CalleeSample->getFuncName(TS.first); const Function *Callee = SymbolMap.lookup(CalleeName); if (!Callee || Callee->isDeclaration()) - InlinedGUIDs.insert(FunctionSamples::getGUID(TS.getKey())); + InlinedGUIDs.insert(FunctionSamples::getGUID(TS.first)); } // Import hot child context profile associted with callees. Note that this @@ -2099,7 +2099,7 @@ const auto &CTM = I.second.getCallTargets(); // Filter out possible indirect calls, use direct callee name as anchor. if (CTM.size() == 1) { - StringRef CalleeName = CTM.begin()->first(); + StringRef CalleeName = CTM.begin()->first; const auto &Candidates = CalleeToCallsitesMap.try_emplace( CalleeName, std::set()); Candidates.first->second.insert(Loc); diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -895,7 +895,7 @@ for (const auto &Target : BodySample.second.getCallTargets()) { Result.addCalledTargetSamples(BodySample.first.LineOffset, MaskedDiscriminator, - Remapper(Target.first()), Target.second); + Remapper(Target.first), Target.second); } } for (const auto &CallsiteSamples : Samples.getCallsiteSamples()) {