Skip to content

[ClosureSpecializer] Don't release trivial noescape apply argument twice. #66275

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
Jun 1, 2023

Conversation

nate-chandler
Copy link
Contributor

When a specialization is created, in the original function, releases are added in two different places:
(1) ClosureSpecCloner::populateCloned
(2) rewriteApplyInst

In the former, releases are added for closures which are guaranteed or trivial noescape (but with owned convention). In the latter, releases are added for closures that are owned.

Previously, when emitting releases at (2), whether the closure was trivial noescape wasn't considered. The result was inserting the releases twice, an overrelease.

Here, fix (2) to recognize trivial noescape as not +1.

rdar://110115795

When a specialization is created, in the original function, releases are
added in two different places:
(1) `ClosureSpecCloner::populateCloned`
(2) `rewriteApplyInst`

In the former, releases are added for closures which are guaranteed or
trivial noescape (but with owned convention).
In the latter, releases are added for closures that are owned.

Previously, when emitting releases at (2), whether the closure was
trivial noescape wasn't considered.  The result was inserting the
releases twice, an overrelease.

Here, fix (2) to recognize trivial noescape as not +1.

rdar://110115795
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nate-chandler nate-chandler changed the title [ClosureSpecializer] Don't release trivial noescape apply arg twice. [ClosureSpecializer] Don't release trivial noescape apply argument twice. Jun 1, 2023
@nate-chandler nate-chandler merged commit d16329c into swiftlang:main Jun 1, 2023
@nate-chandler nate-chandler deleted the rdar110115795 branch June 1, 2023 20:30
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