Skip to content

[6.1] AliasAnalysis: consider memory effects of a consume/destroy of a class on it's let-fields #78792

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
Jan 22, 2025

Conversation

eeckstein
Copy link
Contributor

  • Explanation: Fixes a bug in alias-analysis which can cause a mis-compile by moving a release of an object before the load of a let-field. Although a let-field can never be mutated, a release or consume of the class must be considered as writing to such a field.
  • Risk: Low. It's a small change which makes alias-analysis more conservative.
  • Testing: Tested by a lit test.
  • Issue: rdar://142996449
  • Reviewer: @meg-gupta
  • Main branch PR: AliasAnalysis: consider memory effects of a consume/destroy of a class on it's let-fields #78754. Note that this only cherry-picks the essential bug-fix commit to reduce the risk.

@eeckstein eeckstein requested a review from a team as a code owner January 21, 2025 20:32
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from meg-gupta January 21, 2025 20:33
…s on it's let-fields

Although a let-field can never be mutated, a release or consume of the class must be considered as writing to such a field.

This change removes the special handling of let-fields in two places, where they don't belong.
Class fields are handled by ImmutableScope anyway.
Handling of global let-variable is temporarily removed by this commit.

Fixes a miscompile.
rdar://142996449
@eeckstein eeckstein force-pushed the fix-alias-analysis-6.1 branch from 2a5c5b8 to ed26847 Compare January 22, 2025 07:28
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein enabled auto-merge January 22, 2025 07:58
@eeckstein eeckstein merged commit a992503 into swiftlang:release/6.1 Jan 22, 2025
5 checks passed
@eeckstein eeckstein deleted the fix-alias-analysis-6.1 branch January 22, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants