[llvm] [MemProf] Fix when CallStackTrie is a single chain with multi alloc type (PR #79433)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 19:33:26 PST 2024


================
@@ -244,12 +244,18 @@ bool CallStackTrie::buildAndAttachMIBMetadata(CallBase *CI) {
   MIBCallStack.push_back(AllocStackId);
   std::vector<Metadata *> MIBNodes;
   assert(!Alloc->Callers.empty() && "addCallStack has not been called yet");
-  buildMIBNodes(Alloc, Ctx, MIBCallStack, MIBNodes,
-                /*CalleeHasAmbiguousCallerContext=*/true);
-  assert(MIBCallStack.size() == 1 &&
-         "Should only be left with Alloc's location in stack");
-  CI->setMetadata(LLVMContext::MD_memprof, MDNode::get(Ctx, MIBNodes));
-  return true;
+  if (buildMIBNodes(Alloc, Ctx, MIBCallStack, MIBNodes,
+                    Alloc->Callers.size() > 1)) {
----------------
lifengxiang1025 wrote:

Thanks! I think you are right.

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


More information about the llvm-commits mailing list