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

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 18:03:09 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:

Ok, OOO, fix later.

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


More information about the llvm-commits mailing list