diff options
Diffstat (limited to 'llvm/lib/ProfileData/ProfileSummaryBuilder.cpp')
| -rw-r--r-- | llvm/lib/ProfileData/ProfileSummaryBuilder.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp b/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp index 755e25b355a8..8e07478fb083 100644 --- a/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp +++ b/llvm/lib/ProfileData/ProfileSummaryBuilder.cpp @@ -18,6 +18,7 @@ using namespace llvm; +namespace llvm { cl::opt<bool> UseContextLessSummary( "profile-summary-contextless", cl::Hidden, cl::desc("Merge context profiles before calculating thresholds.")); @@ -64,6 +65,7 @@ cl::opt<uint64_t> ProfileSummaryColdCount( "profile-summary-cold-count", cl::ReallyHidden, cl::desc("A fixed cold count that overrides the count derived from" " profile-summary-cutoff-cold")); +} // namespace llvm // A set of cutoff values. Each value, when divided by ProfileSummary::Scale // (which is 1000000) is a desired percentile of total counts. @@ -93,6 +95,10 @@ void InstrProfSummaryBuilder::addRecord(const InstrProfRecord &R) { // instrumentation profiles. // Eventually MaxFunctionCount will become obsolete and this can be // removed. + + if (R.getCountPseudoKind() != InstrProfRecord::NotPseudo) + return; + addEntryCount(R.Counts[0]); for (size_t I = 1, E = R.Counts.size(); I < E; ++I) addInternalCount(R.Counts[I]); @@ -220,22 +226,17 @@ std::unique_ptr<ProfileSummary> InstrProfSummaryBuilder::getSummary() { } void InstrProfSummaryBuilder::addEntryCount(uint64_t Count) { + assert(Count <= getInstrMaxCountValue() && + "Count value should be less than the max count value."); NumFunctions++; - - // Skip invalid count. - if (Count == (uint64_t)-1) - return; - addCount(Count); if (Count > MaxFunctionCount) MaxFunctionCount = Count; } void InstrProfSummaryBuilder::addInternalCount(uint64_t Count) { - // Skip invalid count. - if (Count == (uint64_t)-1) - return; - + assert(Count <= getInstrMaxCountValue() && + "Count value should be less than the max count value."); addCount(Count); if (Count > MaxInternalBlockCount) MaxInternalBlockCount = Count; |
