[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 22:59:51 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:
After updaing code, now if CallStackTrie has a single chain to leaf with multi alloc type, buildMIBNodes will return false and we'll conservatively give this alloc non-cold allocation type.
https://github.com/llvm/llvm-project/pull/79433
More information about the llvm-commits
mailing list