[PATCH] D108437: [CSSPGO] split context string III - llvm-profgen changes

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 14:18:57 PDT 2021


wmi added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfiledBinary.h:124
   // Offset to context location map. Used to expand the context.
-  std::unordered_map<uint64_t, FrameLocationStack> Offset2LocStackMap;
+  std::unordered_map<uint64_t, SampleContextStorageType> Offset2LocStackMap;
   // An array of offsets of all instructions sorted in increasing order. The
----------------
hoy wrote:
> wmi wrote:
> > I guess Offset2LocStackMap will serve as the immutable storage of all SampleContextStorageType. Is there way to enforce its immutability?
> Yes, it should be immutable once after symbolization is done. The checking of that may not be as easy as the CSName table in the reader. On the other hand, a std::unordered_map operation should not invalidate the values unless it removes or replaces the value. It should just work as other fields like the `FuncStartAddrMap` above. What do you think?
Ah, ok, just find that iterators will be invalidated for unordered_map rehashing but pointers and references will still be valid. So it is fine. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108437/new/

https://reviews.llvm.org/D108437



More information about the llvm-commits mailing list