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

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 23 04:06:54 PST 2025


================
@@ -396,19 +403,41 @@ class ProfiledBinary {
 
   StringRef getPath() const { return Path; }
   StringRef getName() const { return llvm::sys::path::filename(Path); }
-  uint64_t getBaseAddress() const { return BaseAddress; }
-  void setBaseAddress(uint64_t Address) { BaseAddress = Address; }
+  uint64_t getBaseAddress(int32_t PID) const {
----------------
Heath123 wrote:

Are you suggesting that the map is moved to the perf script parser, or removed entirely?
 
We do need the map to do the normalisation, since we need to know the base address which is only recorded in mmap events and not individual samples, so it has to be stored.
 
If you mean keep the map but move it, I do see the argument for moving fields that are dependent on the profile (rather than the binary itself) out of the `ProfiledBinary` class. In this case, it looks like `LastSeenPID`, `FirstLoadableAddress`, `NonTextMMapEvents`, `IsLoadedByMMap` and `MissingMMapWarned` should also be moved; but this seems like general refactoring and I'm not sure if this is in scope for this PR.
 
While looking at this, I've realised that it looks like `NonTextMMapEvents` should also be indexed by PID, so this will need to be implemented too.

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


More information about the llvm-commits mailing list