llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-bolt Author: Amir Ayupov (aaupov) <details> <summary>Changes</summary> Test Plan: NFC --- Full diff: https://github.com/llvm/llvm-project/pull/199321.diff 2 Files Affected: - (modified) bolt/include/bolt/Profile/DataAggregator.h (+4-1) - (modified) bolt/lib/Profile/DataAggregator.cpp (+12-7) ``````````diff diff --git a/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h index 95c6454c4f8cd..5f63087ec7409 100644 --- a/bolt/include/bolt/Profile/DataAggregator.h +++ b/bolt/include/bolt/Profile/DataAggregator.h @@ -389,7 +389,10 @@ class DataAggregator : public DataReader { std::optional<std::pair<StringRef, StringRef>> parseNameBuildIDPair(); /// Coordinate reading and parsing of perf.data file - void parsePerfData(BinaryContext &BC); + void parsePerfData(); + + /// Parse this aggregator's input file. + void parseInput(); /// Mark binary functions covered by parsed profile data. void markFunctionsWithProfile(); diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index 5b8e03a59a6b0..33bfda160ae58 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -580,7 +580,7 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process, return PI.ReturnCode; } -void DataAggregator::parsePerfData(BinaryContext &BC) { +void DataAggregator::parsePerfData() { auto ErrorCallback = [](int ReturnCode, StringRef ErrBuf) { errs() << "PERF-ERROR: return code " << ReturnCode << "\n" << ErrBuf; exit(1); @@ -593,7 +593,7 @@ void DataAggregator::parsePerfData(BinaryContext &BC) { ErrorCallback(ReturnCode, ErrBuf); }; - if (std::optional<StringRef> FileBuildID = BC.getFileBuildID()) { + if (std::optional<StringRef> FileBuildID = BC->getFileBuildID()) { outs() << "BOLT-INFO: binary build-id is: " << *FileBuildID << "\n"; processFileBuildID(*FileBuildID); } else { @@ -601,7 +601,7 @@ void DataAggregator::parsePerfData(BinaryContext &BC) { "not read one from input binary\n"; } - if (BC.IsLinuxKernel) { + if (BC->IsLinuxKernel) { // Current MMap parsing logic does not work with linux kernel. // MMap entries for linux kernel uses PERF_RECORD_MMAP // format instead of typical PERF_RECORD_MMAP2 format. @@ -706,6 +706,13 @@ void DataAggregator::imputeFallThroughs() { outs() << "BOLT-INFO: imputed " << InferredTraces << " traces\n"; } +void DataAggregator::parseInput() { + if (opts::ReadPreAggregated) + parsePreAggregated(); + else + parsePerfData(); +} + Error DataAggregator::preprocessProfile(BinaryContext &BC) { this->BC = &BC; @@ -715,12 +722,10 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) { exit(1); } exit(0); - } else if (opts::ReadPreAggregated) { - parsePreAggregated(); - } else { - parsePerfData(BC); } + parseInput(); + markFunctionsWithProfile(); // Sort parsed traces for faster processing. `````````` </details> https://github.com/llvm/llvm-project/pull/199321 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
