-
Notifications
You must be signed in to change notification settings - Fork 14.3k
release/19.x: [RemoveDIs] Fix spliceDebugInfo splice-to-end edge case (#105671, #106723) #106952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -975,8 +975,16 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, | |
if (ReadFromTail && Src->getMarker(Last)) { | ||
DbgMarker *FromLast = Src->getMarker(Last); | ||
if (LastIsEnd) { | ||
Dest->adoptDbgRecords(Src, Last, true); | ||
// adoptDbgRecords will release any trailers. | ||
if (Dest == end()) { | ||
// Abosrb the trailing markers from Src. | ||
assert(FromLast == Src->getTrailingDbgRecords()); | ||
createMarker(Dest)->absorbDebugValues(*FromLast, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
FromLast->eraseFromParent(); | ||
Src->deleteTrailingDbgRecords(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Here the trailing marker is deleted (eraseFromParent) and unlinked from its parent (deleteTrailingDbgRecords) - the order doesn't matter because |
||
} else { | ||
// adoptDbgRecords will release any trailers. | ||
Dest->adoptDbgRecords(Src, Last, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same behaviour as before the patch in the else branch. |
||
} | ||
assert(!Src->getTrailingDbgRecords()); | ||
} else { | ||
// FIXME: can we use adoptDbgRecords here to reduce allocations? | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FromLast
can't be null because of the outerSrc->getMarker(Last)
check.