Skip to content

[SILOpt] Apply _Class pre-specializations to wrapped single references #70170

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 2 commits into from
Dec 5, 2023

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Dec 1, 2023

rdar://119047505

A struct wrapping a single reference has an identical layout to the reference itself, so we can apply the same pre-specializations.

rdar://119047505

A struct wrapping a single reference has an identical layout to the reference itself, so we can apply the same pre-specializations.
@drexin drexin requested a review from aschwaighofer December 1, 2023 21:21
@drexin
Copy link
Contributor Author

drexin commented Dec 1, 2023

@swift-ci smoke test

@aschwaighofer
Copy link
Contributor

Does the code (lowered.hasRetainablePointerRepresentation) behave correctly for over aligned structs?

@_alignment(16)
struct S {
  var c : SomeClass
}

@drexin
Copy link
Contributor Author

drexin commented Dec 4, 2023

Does the code (lowered.hasRetainablePointerRepresentation) behave correctly for over aligned structs?

@_alignment(16)
struct S {
  var c : SomeClass
}

Good point! I added a test case and yes, it does not apply the optimization.

@drexin
Copy link
Contributor Author

drexin commented Dec 4, 2023

@swift-ci smoke test

@drexin
Copy link
Contributor Author

drexin commented Dec 4, 2023

@swift-ci smoke test windows

@drexin drexin merged commit d93e65d into swiftlang:main Dec 5, 2023
@drexin drexin deleted the wip-119047505 branch December 5, 2023 05:23
Catfish-Man pushed a commit to Catfish-Man/swift that referenced this pull request Jan 19, 2024
swiftlang#70170)

* [SILOpt] Apply _Class pre-specializations to wrapped single references

rdar://119047505

A struct wrapping a single reference has an identical layout to the reference itself, so we can apply the same pre-specializations.

* Add test case for overaligned struct
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