-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[DebugInfo] Salvage all stores #72964
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
@swift-ci please test |
f6deefd
to
a4b456b
Compare
Looks like the number of lost variables has actually regressed with the last changes. Needs more work |
f379f65
to
86b6db9
Compare
4ea59e5
to
190a46c
Compare
@swift-ci please test |
@@ -1826,6 +1826,39 @@ void swift::endLifetimeAtLeakingBlocks(SILValue value, | |||
}); | |||
} | |||
|
|||
// Replace a store with an appropriate debug value. | |||
static void transferStoreDebugValue(DebugVarCarryingInst DefiningInst, |
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.
Does DefiningInst
imply that this will only work for
%1 = alloc_stack ..., var x
store %1
and not
%1 = alloc_stack ...
debug_value, var x
store %1
?
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.
It is a DebugVarCarryingInst, so it will be called in both cases: in the first case DefiningInst will be the alloc_stack, in the second case the DefiningInst is the debug_value
7229561
to
c1e7b49
Compare
@swift-ci please test |
@swift-ci please test source compatibility |
c1e7b49
to
23530a0
Compare
23530a0
to
584d1db
Compare
I dropped the commit about uninhabited types, it was causing an infinite loop, and it isn't that impactful |
@swift-ci please test |
@swift-ci please test source compatibility |
/// Returns this location with the auto-generated and prologue bits stripped. | ||
/// These bits only make sense for instructions, and should be stripped for | ||
/// variables. | ||
SILLocation strippedForDebugVariable() const { |
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.
SILLocation strippedForDebugVariable() const { | |
SILLocation cloneWithoutFlags() const { |
Salvage all stores and store_borrow in salvageDebugInfo. Instead of having a special case in Mem2Reg, we can have a more generic implementation which replaces stores with the expected debug info.
Now that Mem2Reg doesn't drop as much info (99.7% less variables dropped by the pass), this also removes the special case in GenericSpecializer (debug values would otherwise be duplicated)
Also, when salvaging stores, we now use the VarInfo's Loc and Scope properties to indicate the declaration of the variable, and use the location of the store for the location where the debug value is set, instead of using a hacky workaround for arguments only.
This PR also adds special support for salvaging copy_addr in the CopyForwarding pass, using the same system for salvaging stores. CopyForwarding is no longer dropping debug info.
This decreases the number of lost variables in the standard library at the SIL level by 1.3%, and doesn't change significantly the amount of variables at the DWARF level.