Skip to content

[ClosureSpecializer] Don't release trivial noescape try_apply argument twice. #66263

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://110058964

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://110058964
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm!

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.

Thank you!

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.

3 participants