[llvm] [MemProf] Convert Hot contexts to NotCold early (PR #124219)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 15:58:00 PST 2025


================
@@ -301,6 +316,22 @@ bool CallStackTrie::buildAndAttachMIBMetadata(CallBase *CI) {
                                 "single");
     return false;
   }
+  // If there were any hot allocation contexts, the Alloc trie node would have
+  // the Hot type set. If so, because we don't currently support cloning for hot
+  // contexts, they should be converted to NotCold. This happens in the cloning
+  // support anyway, however, doing this now enables more aggressive context
+  // trimming when building the MIB metadata (and possibly may make the
+  // allocation have a single NotCold allocation type), greatly reducing
+  // overheads in bitcode, cloning memory and cloning time.
+  if (Alloc->AllocTypes & static_cast<uint8_t>(AllocationType::Hot)) {
+    convertHotToNotCold(Alloc);
----------------
teresajohnson wrote:

> For the former it would be good to have a small test for the flag usage.

I had to remove the test I added there as it checks metadata, and I had forgotten that with this change that would no longer happen. I will submit a follow on test that checks the option, using an unambiguously hot allocation.

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


More information about the llvm-commits mailing list