-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Retain more debug info in SIL optimization passes #85957
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
base: main
Are you sure you want to change the base?
Conversation
e797b25 to
1cb333a
Compare
|
@swift-ci test |
|
@swift-ci smoke test |
|
@swift-ci please smoke benchmark |
adrian-prantl
left a comment
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.
by salvaging info in erase(instructionIncludingDebugUses:), rather than inserting many explicit salvageDebugInfo calls throughout the code to make the test cases pass.
Nice
atrick
left a comment
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.
LGTM, except I would either drop the notifyNewInstruictions change or have salvageDebugInfo return a bool if it made changes
| /// new `debug_value` instruction before this instruction is deleted. | ||
| public func salvageDebugInfo(of instruction: Instruction) { | ||
| BridgedContext.salvageDebugInfo(instruction.bridged) | ||
| notifyInstructionsChanged() |
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.
We should only notify instructions changed when a new debug_value was actually inserted. We don't want to do this if there was no debug_info to salvage.
I think my TODO refers to CanonicalizeInstruction::notifyNewInstruction. The SwiftCompilerSources bridging API was added later by @eeckstein. You can probably just delete that TODO for two reasons
- I don't think Canonicalization calls back to SwiftCompilerSources and we're not adding new C++ canonicalization
- I can't imagine any analysis would actually need to know whether a new
debug_valueinstruction was created
More generally, do we care at all if salvageDebugInfo invalidates or notifies the context?
@eeckstein what do you think and what's the best strategy for notifying the context about new debug_value? I'm fine either ignoring the new instruction, or returning a bool if any change was made and letting the bridging API call notifyInstructionsChanged conditionally.
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.
I have removed the notifyInstructionsChanged() call from the bridged function (see below).
1cb333a to
6f8cc4a
Compare
|
@swift-ci test |
|
@swift-ci smoke test |
This reverts commit b1eb70b. The original PR (swiftlang#85244) was reverted (swiftlang#85836) due to rdar://165667449 This version fixes the aforementioned issue, and (potentially) improves overall debug info retention by salvaging info in erase(instructionIncludingDebugUses:), rather than inserting many explicit salvageDebugInfo calls throughout the code to make the test cases pass. Bridging: Make salvageDebugInfo a method of MutatingContext This feels more consistent than making it a method of Instruction. DebugInfo: Salvage from trivially dead instructions This handles the case we were checking in constantFoldBuiltin, so we do not need to salvage debug info there any more.
6f8cc4a to
1510673
Compare
|
Previous MacOS platform test failed due to a timeout caused by verbose logging in an LLDB test, which was no longer needed: |
|
@swift-ci smoke test |
|
@swift-ci test macos |
|
@swift-ci smoke test macos |
The original PR (#85244) was reverted (#85836) due to rdar://165667449
This version fixes the aforementioned issue, and (potentially) improves overall debug info retention by salvaging info in
erase(instructionIncludingDebugUses:), rather than inserting many explicitsalvageDebugInfocalls throughout the code to make the test cases pass.