[DebugInfo] Avoid dropping debug reconstruction blocks#89412
Open
Snowy1803 wants to merge 6 commits into
Open
Conversation
3b131b0 to
075d263
Compare
20f2b5f to
f277eaa
Compare
Member
Author
|
@swift-ci test |
Member
Author
|
@swift-ci test macOS platform |
Member
Author
|
@swift-ci test windows platform |
f277eaa to
19c87fd
Compare
Member
Author
|
@swift-ci test |
1 similar comment
Member
Author
|
@swift-ci test |
adrian-prantl
approved these changes
May 28, 2026
19c87fd to
7bb29d3
Compare
Member
Author
|
@swift-ci smoke test |
This function drops debug_value operands by making them undef, rather than deleting them.
The CapturePromotion and MovedAsyncVarDebugInfoPropagator passes clone debug values without going through the SILCloner, so they don't handle debug basic blocks. Luckily, they should never see debug basic blocks, as they are called before or instead of any optimizations that might create them. Add an assertion to make sure of this.
This new function reverses prependDeref. Mem2reg will call it to remove the deref from a debug_value. If the debug_value relies on the address rather than the value behind it, it kills the operand.
When a store was being salvaged, the reconstruction block was dropped, which could cause invalid debug values to be created. Reconstruction blocks are now cloned with the debug values, and the uses of the address removed by stripDeref. Assisted-by: Claude
If a debug_value on an alloc_stack being SROA'ed has a debug reconstruction block, for example if the variable represents the pointer value directly, its value needs to be dropped and marked as unsalvageable.
7bb29d3 to
fe17812
Compare
Member
Author
|
@swift-ci smoke test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auditing everywhere DebugValueInst are cloned, changed, or created by passes, to make sure the debug reconstruction blocks remain correct.
PhiExpansion is fixed in a separate PR: #89471
salvage struct&tuple is fixed in #89504