@@ -2845,9 +2845,8 @@ static int showInstrProfile(ShowFormat SFormat, raw_fd_ostream &OS) {
28452845 auto FS = vfs::getRealFileSystem ();
28462846 auto ReaderOrErr = InstrProfReader::create (Filename, *FS);
28472847 std::vector<uint32_t > Cutoffs = std::move (DetailedSummaryCutoffs);
2848- if (Cutoffs.empty ())
2849- if (ShowDetailedSummary || ShowHotFuncList)
2850- Cutoffs = ProfileSummaryBuilder::DefaultCutoffs;
2848+ if (Cutoffs.empty () && (ShowDetailedSummary || ShowHotFuncList))
2849+ Cutoffs = ProfileSummaryBuilder::DefaultCutoffs;
28512850 InstrProfSummaryBuilder Builder (std::move (Cutoffs));
28522851 if (Error E = ReaderOrErr.takeError ())
28532852 exitWithError (std::move (E), Filename);
@@ -2859,7 +2858,7 @@ static int showInstrProfile(ShowFormat SFormat, raw_fd_ostream &OS) {
28592858 int NumVPKind = IPVK_Last - IPVK_First + 1 ;
28602859 std::vector<ValueSitesStats> VPStats (NumVPKind);
28612860
2862- std::vector<std::pair<uint64_t , uint64_t >> NameRefAndMaxCount ;
2861+ std::vector<std::pair<StringRef , uint64_t >> NameAndMaxCount ;
28632862
28642863 if (!TextFormat && OnlyListBelow) {
28652864 OS << " The list of functions with the maximum counter less than "
@@ -2934,8 +2933,7 @@ static int showInstrProfile(ShowFormat SFormat, raw_fd_ostream &OS) {
29342933 continue ;
29352934
29362935 if (TopNFunctions || ShowHotFuncList)
2937- NameRefAndMaxCount.emplace_back (IndexedInstrProf::ComputeHash (Func.Name ),
2938- FuncMax);
2936+ NameAndMaxCount.emplace_back (Func.Name , FuncMax);
29392937
29402938 if (Show) {
29412939 if (!ShownFunctions)
@@ -3015,25 +3013,26 @@ static int showInstrProfile(ShowFormat SFormat, raw_fd_ostream &OS) {
30153013 }
30163014
30173015 // Sort by MaxCount in decreasing order
3018- llvm::stable_sort (NameRefAndMaxCount , [](const auto &L, const auto &R) {
3016+ llvm::stable_sort (NameAndMaxCount , [](const auto &L, const auto &R) {
30193017 return L.second > R.second ;
30203018 });
30213019 if (TopNFunctions) {
30223020 OS << " Top " << TopNFunctions
30233021 << " functions with the largest internal block counts: \n " ;
3024- auto TopFuncs = ArrayRef (NameRefAndMaxCount).take_front (TopNFunctions);
3025- for (auto [NameRef, MaxCount] : TopFuncs)
3026- OS << " " << Reader->getSymtab ().getFuncOrVarName (NameRef)
3027- << " , max count = " << MaxCount << " \n " ;
3022+ auto TopFuncs = ArrayRef (NameAndMaxCount).take_front (TopNFunctions);
3023+ for (auto [Name, MaxCount] : TopFuncs)
3024+ OS << " " << Name << " , max count = " << MaxCount << " \n " ;
30283025 }
30293026
30303027 if (ShowHotFuncList) {
30313028 auto HotCountThreshold =
30323029 ProfileSummaryBuilder::getHotCountThreshold (PS->getDetailedSummary ());
30333030 OS << " # Hot count threshold: " << HotCountThreshold << " \n " ;
3034- for (auto [NameRef, MaxCount] : NameRefAndMaxCount)
3035- if (MaxCount >= HotCountThreshold)
3036- OS << Reader->getSymtab ().getFuncOrVarName (NameRef) << " \n " ;
3031+ for (auto [Name, MaxCount] : NameAndMaxCount) {
3032+ if (MaxCount < HotCountThreshold)
3033+ break ;
3034+ OS << Name << " \n " ;
3035+ }
30373036 }
30383037
30393038 if (ShownFunctions && ShowIndirectCallTargets) {
0 commit comments