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

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 13 16:49:53 PST 2025


================
@@ -198,7 +198,14 @@ class ProfiledBinary {
   // Options used to configure the symbolizer
   symbolize::LLVMSymbolizer::Options SymbolizerOpts;
   // The runtime base address that the first executable segment is loaded at.
-  uint64_t BaseAddress = 0;
+  // The binary may be loaded at different addresses in different processes,
+  // so we use a map to store base address by PID.
+  // If the profile doesn't contain PID info we use the default PID value
+  // (DefaultPID defined in PerfReaderBase).
+  std::unordered_map<int32_t, uint64_t> BaseAddressByPID;
----------------
snehasish wrote:

> For example, it can be used to profile a build where ninja invokes Clang many times.

Apologies if I'm being dense but isn't this use case covered by the fact that we can match based on the filename? 

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


More information about the llvm-commits mailing list