Skip to content

[CherryPick] Fixes for HotColdSplit debug information propagation #5777

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

Conversation

felipepiovezan
Copy link

No description provided.

@felipepiovezan
Copy link
Author

@swift-ci test

When a new function "NewF" is created with instructions extracted from
another function "OldF", the CodeExtractor only preserves debug
line/column of the extracted instructions. However:

1. Any inlinedAt nodes are dropped.
2. The scope chain is replaced with a single node, the Subprogram of NewF.

Both of these are incorrect: most of the debug metadata from the
original instructions should be preserved. We only need to update the
Subprogram found at the scope of the last node of the inline chain; this
Subprogram used to be OldF but now should be NewF.

Differential Revision: https://reviews.llvm.org/D139217
When a dbg.value instruction for a variable V is extracted into a new
function, the scope of the underlying variable should be set to the new
function iff V was in the scope of the old function (i.e. it hadn't been
inlined). Prior to this patch, the code extractor would always update
the scope of V.

Differential Revision: https://reviews.llvm.org/D139669
This utility will be useful in subsequent patches, as such we expose it
in the DebugInfoMetadata header.

Depends on D139669

Differential Revision: https://reviews.llvm.org/D139670
When a dbg.value is moved into a new function, the corresponding
variable should have its entire scope chain reparented with the new
function. The current implementation drops the scope chain and replaces
it with a subprogram for the new function.

Differential Revision: https://reviews.llvm.org/D139671
dbg.labels that were inlined from other functions should have their
scope preserved upon outlining for the same reasons described in
D139669.
When a dbg.label is moved into a new function, its corresponding scope
should be preserved, with the exception of the subprogram at the end of
the scope chain, which should now be the subprogram of the destination
function. See D139671.

Differential Revision: https://reviews.llvm.org/D139849
Apply the same strategy from D139217 to loop debug locations.

Differential Revision: https://reviews.llvm.org/D139851
@felipepiovezan felipepiovezan force-pushed the felipe/cherrypick_hotcold_fixes_0421 branch from 484f015 to ac681a3 Compare December 14, 2022 00:20
@felipepiovezan
Copy link
Author

@swift-ci test

@felipepiovezan felipepiovezan merged commit dbdd828 into swiftlang:stable/20220421 Dec 14, 2022
@felipepiovezan felipepiovezan deleted the felipe/cherrypick_hotcold_fixes_0421 branch December 14, 2022 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant