Skip to content

Conversation

@eeckstein
Copy link
Contributor

When replacing a switch_enum of an owned enum value with a branch to a non-payload case destination, we need to insert a destroy of the enum value.

Fixes a SIL ownership verification failure.
#84552
rdar://161482601

When replacing a `switch_enum` of an owned enum value with a branch to a non-payload case destination,
we need to insert a destroy of the enum value.

Fixes a SIL ownership verification failure.
swiftlang#84552
rdar://161482601
@eeckstein eeckstein requested a review from meg-gupta October 15, 2025 09:25
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein eeckstein merged commit 412fffc into swiftlang:main Oct 15, 2025
3 checks passed
@eeckstein eeckstein deleted the fix-simplify-cfg branch October 15, 2025 18:13
@meg-gupta
Copy link
Contributor

lgtm

eeckstein added a commit to eeckstein/swift that referenced this pull request Oct 20, 2025
…tch_enum`

This is a follow-up of swiftlang#84905, which handles non-copyable enums with a deinit correctly.
Also, for copyable enums it's more efficient to use `end_lifetime` than `destroy_value`, because we already know that the enum contains a trivial case.
Therefore no destroy operation is needed.
eeckstein added a commit to eeckstein/swift that referenced this pull request Oct 20, 2025
…tch_enum`

This is a follow-up of swiftlang#84905, which handles non-copyable enums with a deinit correctly.
Also, for copyable enums it's more efficient to use `end_lifetime` than `destroy_value`, because we already know that the enum contains a trivial case.
Therefore no destroy operation is needed.
dendiz pushed a commit to dendiz/swift that referenced this pull request Oct 21, 2025
…tch_enum`

This is a follow-up of swiftlang#84905, which handles non-copyable enums with a deinit correctly.
Also, for copyable enums it's more efficient to use `end_lifetime` than `destroy_value`, because we already know that the enum contains a trivial case.
Therefore no destroy operation is needed.
eeckstein added a commit to eeckstein/swift that referenced this pull request Oct 23, 2025
…tch_enum`

This is a follow-up of swiftlang#84905, which handles non-copyable enums with a deinit correctly.
Also, for copyable enums it's more efficient to use `end_lifetime` than `destroy_value`, because we already know that the enum contains a trivial case.
Therefore no destroy operation is needed.
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