[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


================
@@ -670,14 +703,37 @@ bool PerfScriptReader::extractLBRStack(TraceStream &TraceIt,
 
   // Skip the leading instruction pointer.
   size_t Index = 0;
+  // Default to PID 0 if not provided
+  int32_t PID = 0;
   uint64_t LeadingAddr;
+
+  if (Records.size() < (MultiProcessProfile ? 2 : 1)) {
+    WarnInvalidLBR(TraceIt);
+    TraceIt.advance();
+    return false;
+  }
+
+  if (MultiProcessProfile) {
+    // If we read the PID elsewhere, use that instead of trying to read it here
+    if (PIDIfKnown.has_value()) {
----------------
apolloww wrote:

Would the just read PID be different from `PIDIfKnown`?

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


More information about the llvm-commits mailing list