[llvm] [MemProf] Track and report profiled sizes through cloning (PR #98382)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 08:52:17 PDT 2024


================
@@ -611,6 +614,8 @@ class CallsiteContextGraph {
   /// Map from each context ID to the AllocationType assigned to that context.
   DenseMap<uint32_t, AllocationType> ContextIdToAllocationType;
 
+  std::map<uint32_t, uint64_t> ContextIdToTotalSize;
----------------
teresajohnson wrote:

Hmm, according to https://llvm.org/docs/ProgrammersManual.html#other-map-like-container-options:

"We never use containers like unordered_map because they are generally very expensive (each insertion requires a malloc)."

But I do see that I use unordered_map elsewhere in this file, probably due to a previous review comment. Is the advice in the documentation outdated?

In any case this should probably at least be a DenseMap, will make that change for now.

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


More information about the llvm-commits mailing list