Skip to content

Let Character literals, which fit into 64 bits, be folded into a single integer constant. #9225

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
May 3, 2017

Conversation

eeckstein
Copy link
Contributor

@eeckstein eeckstein commented May 3, 2017

This is done by ensuring that the corresponding Character constructor is inlined. llvm will do the constant folding.
Also add a test which checks this.

It makes character literals much faster (3x improvement for the CharacterLiteralsSmall benchmark)
And it removes a lot of redundant code (~80% for the CharacterLiteralsSmall benchmark)

rdar://problem/22481219

eeckstein added 3 commits May 3, 2017 09:05
…e optimizer to remove a result of a computation.

It’s similar to the _blackHole function in the stdlib unit tests.
…er results in the CharacterLiteralsSmall benchmark.
…le integer constant.

This is done by ensuring that the corresponding Character constructor is inlined. llvm will do the constant folding.
Also add a test which checks this.

It makes character literals much faster (3x improvement for the CharacterLiteralsSmall benchmark)
And it removes _a lot_ of redundant code (~80% for the CharacterLiteralsSmall benchmark)
@eeckstein
Copy link
Contributor Author

@swift-ci Please smoke test

@eeckstein
Copy link
Contributor Author

@swiftix Can you please take a look at the stdlib changes?

@swiftix
Copy link
Contributor

swiftix commented May 3, 2017

@eeckstein Overall, it looks good.

Have you looked at the code size of the stdlib and benchmark executables after this change? What are the numbers?

@eeckstein
Copy link
Contributor Author

No significant changes on code size, except -80% on CharacterLiteralsSmall

@eeckstein eeckstein merged commit b1769df into swiftlang:master May 3, 2017
@eeckstein eeckstein deleted the char-literals branch May 3, 2017 17:59
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