[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:27 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:

I think it would be clearer to be more explicit, and just have a flag or something else to skip the checking during first iteration below.

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


More information about the llvm-commits mailing list