[llvm] [MemProf] Add assert to make sure ContextIterBegin isn't at StackContext.end() (PR #81004)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 07:36:49 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: None (lifengxiang1025)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/81004.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp (+1) 


``````````diff
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index d81239dd49e4cc..6705c2337f04a6 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -3474,6 +3474,7 @@ bool MemProfContextDisambiguation::applyImport(Module &M) {
             CallStack<MDNode, MDNode::op_iterator> StackContext(StackMDNode);
             auto ContextIterBegin =
                 StackContext.beginAfterSharedPrefix(CallsiteContext);
+            assert(ContextIterBegin != StackContext.end());
             // Skip the checking on the first iteration.
             uint64_t LastStackContextId = *ContextIterBegin == 0 ? 1 : 0;
             for (auto ContextIter = ContextIterBegin;

``````````

</details>


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


More information about the llvm-commits mailing list