Skip to content

Commit 0ca6b2b

Browse files
[MemProf] Fix an incorrect iterator increment (#123438)
We pass in a pointer to an Edge iterator to moveEdgeToExistingCalleeClone, so that it can be correctly updated when we remove edges during an edge iteration. We were not dereferencing this pointer in one case, meaning we would increment the pointer and not the iterator as intended. This did not cause any issues, as it turns out that we would simply skip the edge on the next iteration as it was already appropriately handled. While in theory this incurred some extra compilation time, in practice for a large application the effect was not significant. I confirmed that there was no effect to any cloning from the fix. I plan to send a follow up change to avoid the need to pass in an iterator at all and simplify / consolidate the handling in the caller, but want to fix this in case something requires a revert of the follow on fix.
1 parent 8770126 commit 0ca6b2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3110,7 +3110,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
31103110
} else {
31113111
// Only moving a subset of Edge's ids.
31123112
if (CallerEdgeI)
3113-
++CallerEdgeI;
3113+
++(*CallerEdgeI);
31143114
// Compute the alloc type of the subset of ids being moved.
31153115
auto CallerEdgeAllocType = computeAllocType(ContextIdsToMove);
31163116
if (ExistingEdgeToNewCallee) {

0 commit comments

Comments
 (0)