[llvm] [MemProf] Fix assert when exists direct recursion (PR #78264)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 10:44:26 PST 2024
================
@@ -3472,15 +3472,19 @@ bool MemProfContextDisambiguation::applyImport(Module &M) {
assert(StackMDNode);
SmallVector<unsigned> StackIdsFromMetadata;
CallStack<MDNode, MDNode::op_iterator> StackContext(StackMDNode);
- for (auto ContextIter =
- StackContext.beginAfterSharedPrefix(CallsiteContext);
+ auto ContextIterBegin =
+ StackContext.beginAfterSharedPrefix(CallsiteContext);
+ uint64_t LastStackContextId = *ContextIterBegin == UINT64_MAX
----------------
teresajohnson wrote:
Or maybe use value 0, or 1 if the first context id happens to be 0. I think that would be clearer than using value + or - 1 depending on whether it is max uint. Regardless, please add a comment about what we're trying to do (skip the checking on the first iteration).
https://github.com/llvm/llvm-project/pull/78264
More information about the llvm-commits
mailing list