Skip to content

6.0: [NoncopyableWrapperElim] Process undef values. #74335

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

nate-chandler
Copy link
Contributor

Explanation: Fix an assert-on-valid involving debug info for noncopyable types.

The debug_value instructions help map variable names to their values. When a value is consumed, a debug_value undef is emitted, telling the debugger that the corresponding name no longer maps to a value that's available. SIL verification requires that the type of every mapped to a name by a debug_value has the same type--including undef values.

To facilitate checking of consuming and related features, normally copyable types are wrapped by a builtin noncopyable generic type (spelled @moveOnly T). This type only exists during part of the mandatory pass pipeline; the MoveOnlyWrappedTypeEliminator removes all occurrences.

Previously, that pass wasn't updating debug_value instructions whose value was an undef of @moveOnly wrapped type (e.g. debug_value undef : $@moveOnly X). This resulted in a verification failure because other debug_value instructions which specified the current value for a name had had their operand's type unwrapped (e.g. debug_value %4 : $X).

Here, this is fixed by visiting replacing uses of undefs whose type is wrapped this way with undefs whose type is obtained by unwrapping. For example, all uses of undef : $@moveOnly X are replaced with uses of undef : $X.
Scope: Affects noncopyable code.
Issue: rdar://129593468
Original PR: #74298
Risk: Low.
Testing: Added and updated tests.
Reviewer: Andrew Trick ( @atrick )

removing...To -> removing...From
This predicate is used in several places.
Replaced copy-pasted code with a twice-invoked closure.  In preparation
to add a third invocation.
The modified arguments were recorded but never used.
Such values' types may also also be move-only wrapped.
@nate-chandler nate-chandler requested a review from a team as a code owner June 12, 2024 14:30
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler enabled auto-merge June 12, 2024 17:43
@nate-chandler nate-chandler merged commit d4f8339 into swiftlang:release/6.0 Jun 12, 2024
5 checks passed
@nate-chandler nate-chandler deleted the cherrypick/release/6.0/rdar129593468 branch June 12, 2024 22:15
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.

2 participants