[llvm] [BOLT][AArch64] Introduce SPE mode in BasicAggregation (PR #120741)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 07:07:10 PST 2025


================
@@ -1226,6 +1247,66 @@ ErrorOr<DataAggregator::PerfBasicSample> DataAggregator::parseBasicSample() {
   return PerfBasicSample{Event.get(), Address};
 }
 
+ErrorOr<
+    std::pair<DataAggregator::PerfBasicSample, DataAggregator::PerfBasicSample>>
+DataAggregator::parseSpeAsBasicSamples() {
+  while (checkAndConsumeFS()) {
+  }
+
+  ErrorOr<int64_t> PIDRes = parseNumberField(FieldSeparator, true);
+  if (std::error_code EC = PIDRes.getError())
+    return EC;
+
+  constexpr PerfBasicSample EmptySample = PerfBasicSample{StringRef(), 0};
+  auto MMapInfoIter = BinaryMMapInfo.find(*PIDRes);
+  if (MMapInfoIter == BinaryMMapInfo.end()) {
+    consumeRestOfLine();
+    return std::make_pair(EmptySample, EmptySample);
+  }
+
+  while (checkAndConsumeFS()) {
----------------
paschalis-mpeis wrote:

Thanks for the suggestion. Could do that but clang-format would require the semicolon to be on the next line anyway. There is similar code to this in other parsing functions like [parseBasicSample()](https://github.com/llvm/llvm-project/blob/61032dec95da15bb7ff646a0178e08f2bb9347e4/bolt/lib/Profile/DataAggregator.cpp#L1211).

https://github.com/llvm/llvm-project/pull/120741


More information about the llvm-commits mailing list