Skip to content

[4.0] Let Character literals, which fit into 64 bits, be folded into a single integer constant. #9353

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

Conversation

eeckstein
Copy link
Contributor

@eeckstein eeckstein commented May 5, 2017

Explanation: Let Character literals that fit into 64 bits, be folded into a single integer constant.
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)

Scope: An optimization improvement

Issue: rdar://problem/22481219

Risk: Low. Except changing inlining decisions, there is no other change in the compiler or library.

Testing: There is a test case in this PR for swift CI

…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

@swiftix Can you please review this for 4.0?

@eeckstein
Copy link
Contributor Author

@swift-ci Please test

@dabrahams
Copy link
Contributor

@eeckstein FYI, German comma placement changes the meaning of that explanation in English. I think you want s/, which/that/

@swiftix
Copy link
Contributor

swiftix commented May 8, 2017

@eeckstein LGTM!

@bob-wilson bob-wilson merged commit 82dd32f into swiftlang:swift-4.0-branch May 8, 2017
@eeckstein eeckstein deleted the char-lits branch May 8, 2017 17:47
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.

4 participants