Skip to content

Improve code generation for arrays of classes. #76908

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 3 commits into from
Oct 9, 2024

Conversation

eeckstein
Copy link
Contributor

  • Constant fold classify_bridge_object to (false, false) if the operand is known to be a swift class.

We already had this optimization in the SILCombiner. But it didn't handle all the cases. Now it's implemented as instruction simplification (in swift) using a ValueUseDefWalker.

  • Don't use pre-specialization for Array._endMutation.

Pre-specialization of Array._endMutation (for AnyObject) prevents inlining this function and that results in sub-optimal code. This function is basically a no-op. So it should be inlined.
Unfortunately we cannot remove the specialize-attributes anymore because the pre-specialized function(s) are now part of the stdlib's ABI. Therefore make an exception for Array._endMutation in the generic specializer.

rdar://137243595

Constant fold `classify_bridge_object` to `(false, false)` if the operand is known to be a swift class.
@eeckstein eeckstein requested review from aschwaighofer and Catfish-Man and removed request for xedin, slavapestov and hborla October 8, 2024 14:31
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

@swift-ci benchmark

…tion`

Pre-specialization of `Array._endMutation` (for AnyObject) prevents inlining this function and that results in sub-optimal code.
This function is basically a no-op. So it should be inlined.

Unfortunately we cannot remove the specialize-attributes anymore because the pre-specialized function(s) are now part of the stdlib's ABI.
Therefore make an exception for `Array._endMutation` in the generic specializer.
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test macos

@eeckstein eeckstein merged commit f65d41e into swiftlang:main Oct 9, 2024
4 of 5 checks passed
@eeckstein eeckstein deleted the array-improvements branch October 9, 2024 10:02
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.

1 participant