[llvm] [llvm-profgen][SPGO] Support profiles with multiple concurrent processes (PR #169353)

Wei Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 16:47:27 PST 2025


================
@@ -818,8 +874,24 @@ void HybridPerfReader::parseSample(TraceStream &TraceIt, uint64_t Count) {
 #ifndef NDEBUG
   Sample->Linenum = TraceIt.getLineNumber();
 #endif
+  // Default to PID 0
+  int32_t PID = 0;
+  if (MultiProcessProfile) {
+    // Parse the PID at the beginning of the sample
+    StringRef FirstLine = TraceIt.getCurrentLine();
+    if (FirstLine.trim().getAsInteger(10, PID)) {
----------------
apolloww wrote:

In the `!MultiProcessProfile` case, the line before the stack is the optional aggregated count (which is also 10-based) for the sample. Would it be a conflict with pid?

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


More information about the llvm-commits mailing list