-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[DebugInfo] Fix loss of variables at -Onone #73387
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
LoadableByAddress was losing debug info, including at -Onone. When converting a load-store pair to a copy_addr, the debug info attached to the load was not salvaged. Additionally, the wrong scope was being attached to other debug values.
AllocStackHoisting was losing debug info, including at -Onone. When two alloc_stacks of the same type are merged, one of them would lose their debug variable. It is now salvaged, with an added debug_value. This case was previously only handled for noncopyable types, it is now done in all cases.
@swift-ci please test |
} | ||
DebugValueToBreakBlocksAt.push_back(DVI); |
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.
this change LGTM
@Snowy1803 @adrian-prantl The idea that SILBuilderWithScope should not be called on certain instruction types is not maintainable. Why can't we just fix it to do the right thing for these instructions? |
By pure chance, I just reviewed code that does this |
@atrick When we know that we have a debug_value, and want to replace it with a new one -> we want to take the debug_value's scope |
@Snowy1803 that makes sense. If those are the rules, then they should at least be specified in |
How about
The one piece which is missing is the skipping of "meta instructions". Should we add this to the first kind of |
@eeckstein Yeah. I think Emil is saying that these APIs should normally skip "meta instructions" But maybe we should have: |
Yes, I think it would make sense to have a |
|
|
Makes sense. Can you open a PR for this?
"replacing" is confusing because it doesn't tell you if the insertion point is before or after the instruction and it's the user's responsibility to actually delete the instruction. If you want this behavior, you can do |
Yes, that's what we currently do in C++ I will open a PR for this |
I think Note that the complete semantics of an API do not need to be in the name. It's perfectly fine to specify behavior in the API coment. |
Fix the loss of variables in 3 mandatory SIL passes:
This fixes all real losses of variables in the standard library when compiling at Onone. It also affects the number of variables available with optimizations on.