Skip to content

[6.0] AST: Remove incorrect optimization from ASTContext::getOpenedExistentialSignature() #72920

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Apr 9, 2024

6.0 cherry-pick of #72919.

  • Description: It is no longer true that the existential signature of any P is always just <Self where Self: P>, because P might be ~Copyable, in which case any P is really any P & Copyable. Just remove the micro-optimization here, because if we're building an existential signature, we're likely going to be doing generic signature queries, and then we'll need a Requirement Machine anyway.

  • Scope of the issue: This happened to manifest in the SIL optimizer when performing the concrete existential peephole with any Sendable, since Sendable is now ~Copyable, but any number of code paths could have run into this.

  • Radar: Fixes rdar://problem/126079282.

  • Reviewed by: @hborla

…ialSignature()

It is no longer true that the existential signature of `any P` is
always just `<Self where Self: P>`, because `P` might be `~Copyable`,
in which case `any P` is really `any P & Copyable`.

Just remove the micro-optimization here, because if we're building
an existential signature, we're likely going to be doing generic
signature queries, and then we'll need a Requirement Machine anyway.

This happened to manifest in the SIL optimizer when performing the
concrete existential peephole with `any Sendable`, since Sendable is
now ~Copyable.

Fixes rdar://problem/126079282.
@slavapestov slavapestov requested a review from a team as a code owner April 9, 2024 03:08
@slavapestov slavapestov changed the title AST: Remove incorrect optimization from ASTContext::getOpenedExistentialSignature() [6.0] AST: Remove incorrect optimization from ASTContext::getOpenedExistentialSignature() Apr 9, 2024
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov merged commit b099cd5 into swiftlang:release/6.0 Apr 9, 2024
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