Skip to content

[DebugInfo] PATCH 2/3: Duplicate logics regarding debug_value_addr #39066

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

Merged

Conversation

mshockwave
Copy link
Contributor

This patch replace all in-memory objects of DebugValueAddrInst with
DebugValueInst + op_deref, and duplicates logics that handles
DebugValueAddrInst with the latter. All related check in the tests
have been updated as well.

Note that this patch neither remove the DebugValueAddrInst class nor
remove debug_value_addr syntax in the test inputs.

This is a PR only for code review. DO NOT MERGE.

@mshockwave
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the hard work!
There is one somewhat important comment in visitDebugValue() that I'd like to address before moving forward.

// utility function to drop it?
assert(VarInfo && VarInfo->DIExpr);
auto &DIExpr = VarInfo->DIExpr;
DIExpr.eraseElement(DIExpr.element_begin());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks backwards. We should never emit a debug_value allocstack, op_deref in SILGen/SILOpt instead of unconditionally stripping the operand here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I forgot to change LoadableByAddress to teach it not to attach op_deref if the value is loadable by address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a FYI of how I fixed it: Instead of changing LoadableByAddress Pass, I simply change SILBuiler to teach it not to generate op_deref for debug_value if the SILValue is alloc_stack.

@mshockwave mshockwave force-pushed the dev-debug-val-addr-deprecation-phase2 branch 3 times, most recently from 3292da9 to 75d430e Compare August 30, 2021 22:38
@mshockwave
Copy link
Contributor Author

@swift-ci please test

@mshockwave mshockwave force-pushed the dev-debug-val-addr-deprecation-phase2 branch from 75d430e to 9cad58f Compare August 30, 2021 23:29
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 75d430e191292581177c8e1922cdbf2026f67b28

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 75d430e191292581177c8e1922cdbf2026f67b28

This new SIL di-expression represents the dereference on the SSA value.
Similar to DW_OP_deref in DWARF. It is also going to replace the
existing `debug_value_addr`. Namely, replacing the following
instruction:
```
debug_value_addr %a : $*T, name "my_var"
```
with this one:
```
debug_value %a : $*T, name "my_var", expr op_deref
```
@mshockwave mshockwave force-pushed the dev-debug-val-addr-deprecation-phase2 branch from 9cad58f to d7a9830 Compare August 31, 2021 17:16
@mshockwave
Copy link
Contributor Author

Update test case
@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - d7a98303e578a178ab976505633e7e124c7c3449

This patch replace all in-memory objects of DebugValueAddrInst with
DebugValueInst + op_deref, and duplicates logics that handles
DebugValueAddrInst with the latter. All related check in the tests
have been updated as well.

Note that this patch neither remove the DebugValueAddrInst class nor
remove `debug_value_addr` syntax in the test inputs.
@mshockwave mshockwave force-pushed the dev-debug-val-addr-deprecation-phase2 branch from d7a9830 to e1023bc Compare August 31, 2021 19:23
@mshockwave
Copy link
Contributor Author

Update a test case in SILOptimizer that hasn't kept up with the previous change of not generating op_deref if the SSA value is alloc_stack. Hopefully this is the last bit (finger crossed)
@swift-ci please test

@mshockwave mshockwave merged commit e1023bc into swiftlang:main Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants