Skip to content

[Devirtualize] Support devirtualization of witness methods when we have a polymorphic type and no substitutions required #15064

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 8, 2018

Conversation

shajrawi
Copy link

@shajrawi shajrawi commented Mar 8, 2018

radar rdar://problem/38085760

SILGen is generating code with “shadow” requirements:
convention(witness_method: ApplyRegStruct) <τ_0_0 where τ_0_0 == Type> (@inout Array) -> () {
// no use of τ_0_0 inside

In this case we have an empty substitution map but a polymorphic function type

We should relax the assert when creating apply instructions to support this case.

@shajrawi
Copy link
Author

shajrawi commented Mar 8, 2018

@swift-ci Please smoke test and merge

@@ -2438,7 +2438,6 @@ CanSILFunctionType
SILFunctionType::substGenericArgs(SILModule &silModule,
SubstitutionList subs) {
if (subs.empty()) {
assert(!isPolymorphic() && "no args for polymorphic substitution");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the right assertion is (!isPolymorphic() || getGenericSignature()->areAllParamsConcrete())

Copy link
Author

Choose a reason for hiding this comment

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

Done

…ve a polymorphic type and no substitutions required

SILGen is generating code with “shadow” requirements:
convention(witness_method: ApplyRegStruct) <τ_0_0 where τ_0_0 == Type> (@inout Array<Type>) -> () {
// no use of τ_0_0 inside

In this case we have an empty substitution map but a polymorphic function type

We should relax the assert when creating apply instructions to support this case.
@shajrawi
Copy link
Author

shajrawi commented Mar 8, 2018

@swift-ci Please smoke test and merge

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