diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -394,61 +394,6 @@ std::string Msg; }; -class SoftInstrProfErrors { - /// Count the number of soft instrprof_errors encountered and keep track of - /// the first such error for reporting purposes. - - /// The first soft error encountered. - instrprof_error FirstError = instrprof_error::success; - - /// The number of hash mismatches. - unsigned NumHashMismatches = 0; - - /// The number of count mismatches. - unsigned NumCountMismatches = 0; - - /// The number of counter overflows. - unsigned NumCounterOverflows = 0; - - /// The number of value site count mismatches. - unsigned NumValueSiteCountMismatches = 0; - -public: - SoftInstrProfErrors() = default; - - ~SoftInstrProfErrors() { - assert(FirstError == instrprof_error::success && - "Unchecked soft error encountered"); - } - - /// Track a soft error (\p IE) and increment its associated counter. - void addError(instrprof_error IE); - - /// Get the number of hash mismatches. - unsigned getNumHashMismatches() const { return NumHashMismatches; } - - /// Get the number of count mismatches. - unsigned getNumCountMismatches() const { return NumCountMismatches; } - - /// Get the number of counter overflows. - unsigned getNumCounterOverflows() const { return NumCounterOverflows; } - - /// Get the number of value site count mismatches. - unsigned getNumValueSiteCountMismatches() const { - return NumValueSiteCountMismatches; - } - - /// Return the first encountered error and reset FirstError to a success - /// value. - Error takeError() { - if (FirstError == instrprof_error::success) - return Error::success(); - auto E = make_error(FirstError); - FirstError = instrprof_error::success; - return E; - } -}; - namespace object { class SectionRef; diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -233,31 +233,6 @@ return SectName; } -void SoftInstrProfErrors::addError(instrprof_error IE) { - if (IE == instrprof_error::success) - return; - - if (FirstError == instrprof_error::success) - FirstError = IE; - - switch (IE) { - case instrprof_error::hash_mismatch: - ++NumHashMismatches; - break; - case instrprof_error::count_mismatch: - ++NumCountMismatches; - break; - case instrprof_error::counter_overflow: - ++NumCounterOverflows; - break; - case instrprof_error::value_site_count_mismatch: - ++NumValueSiteCountMismatches; - break; - default: - llvm_unreachable("Not a soft error"); - } -} - std::string InstrProfError::message() const { return getInstrProfErrString(Err, Msg); }