[llvm] [MemProf] Fix assert when exists direct recursion (PR #78264)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 22:52:53 PST 2024


================
@@ -3470,17 +3470,19 @@ bool MemProfContextDisambiguation::applyImport(Module &M) {
             auto *MIBMD = cast<const MDNode>(MDOp);
             MDNode *StackMDNode = getMIBStackNode(MIBMD);
             assert(StackMDNode);
-            SmallVector<unsigned> StackIdsFromMetadata;
             CallStack<MDNode, MDNode::op_iterator> StackContext(StackMDNode);
-            for (auto ContextIter =
-                     StackContext.beginAfterSharedPrefix(CallsiteContext);
+            auto ContextIterBegin =
+                StackContext.beginAfterSharedPrefix(CallsiteContext);
+            // Skip the checking on the first iteration.
+            uint64_t LastStackContextId = *ContextIterBegin == 0 ? 1 : 0;
----------------
lifengxiang1025 wrote:

>  But at this point I want to unblock our builds.

I think ContextIter should't at StackContext.end(). So maybe add one assert is more reasonable. It's ok to do this to unblock your builds. Thanks for reply.

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


More information about the llvm-commits mailing list