Skip to content

SILMem2Reg: fix a problem with leaking enum values #41744

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
merged 1 commit into from
Mar 9, 2022

Conversation

eeckstein
Copy link
Contributor

When optimizing an enum store to an alloc_stack, require that all uses are in the same block.
Otherwise it could be a switch_enum of an optional where the none-case does not have a destroy of the enum value.
After transforming such an alloc_stack, the value would leak in the none-case block.

It fixes the same OSSA verification error as done for TempRValueOpt in #41724

When optimizing an enum `store` to an `alloc_stack`, require that all uses are in the same block.
Otherwise it could be a `switch_enum` of an optional where the none-case does not have a destroy of the enum value.
After transforming such an `alloc_stack`, the value would leak in the none-case block.

It fixes the same OSSA verification error as done for TempRValueOpt in a previous commit.
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 4beadfe into swiftlang:main Mar 9, 2022
@eeckstein eeckstein deleted the fix-mem2reg branch March 9, 2022 12:53
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