Skip to content

Conversation

@eeckstein
Copy link
Contributor

@eeckstein eeckstein commented Oct 16, 2025

@eeckstein eeckstein requested a review from a team as a code owner October 16, 2025 05:53
@eeckstein
Copy link
Contributor Author

@swift-ci test

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
…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 eeckstein force-pushed the fix-simplify-cfg-6.2 branch from 46bbbd9 to c4c1c50 Compare October 23, 2025 06:18
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

I updated this PR with a cherry-pick of #85006 to also support non-copyable enums

@eeckstein eeckstein merged commit de48c2f into swiftlang:release/6.2 Oct 23, 2025
5 checks passed
@eeckstein eeckstein deleted the fix-simplify-cfg-6.2 branch October 23, 2025 18:47
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