[DebugInfo] Prepend deref to existing DebugValueInsts#89254
Draft
Snowy1803 wants to merge 6 commits into
Draft
Conversation
Debug values have their own, more powerful, type chain check. AllocStackInst have a deref, so this check would be ignored, and AllocBoxInst doesn't support storing a different type.
Load instructions aren't handled in LLVM's salvageDebugInfo due to how unpredictable LLVM's optimization passes can be. In Swift, we only add loads to debug reconstruction blocks if we know it is correct.
Instead of having to recreate new debug value instructions when a deref operator needs to be prepended (in passes where an object is moved to the stack), it is now possible to prepend a deref in place. When a reconstruction block exists, the only correct way to prepend a deref is by adding a load at the start of the reconstruction block, as the reconstruction block is interpreted before the DIExpr. Otherwise, a bit is set on the DebugValueInst to signal that a deref operator must be prepended to the DIExpr returned by getVarInfo. This bit cannot be set if a reconstruction block exists.
Replace uses of createDebugValueAddr in passes, that were used to rewrite debug value instructions with a prepended deref, to use the prependDeref function to prepend it in place.
Replace the use of createDebugValueAddr in salvageLoadDebugInfo, that was used to rewrite debug value instructions with a prepended deref, to use the prependDeref function to prepend it in place, and move it to the correct place.
Remove the now unused SILBuilder::createDebugValueAddr function. Passes must always update existing debug value instructions rather than recreating new ones, and emitDebugDescription has been updated to just prepend an op_deref. This was the last remnant of DebugValueAddrInst.
Member
Author
|
@swift-ci test |
1 similar comment
Member
Author
|
@swift-ci 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.
Based on #89224
Instead of having to recreate new debug value instructions when a deref operator needs to be prepended (in passes where an object is moved to the stack), it is now possible to prepend a deref in place.
When a reconstruction block exists, the only correct way to prepend a deref is by adding a load at the start of the reconstruction block, as the reconstruction block is interpreted before the DIExpr.
Otherwise, a bit is set on the DebugValueInst to signal that a deref operator must be prepended to the DIExpr returned by getVarInfo.
All passes have been updated to use this new prependDeref rather than SILBuilder::createDebugValueAddr, so this function has also been removed.