Skip to content
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

[SR-4581] Optimizer doesn't elide copy #47158

Open
milseman mannequin opened this issue Apr 13, 2017 · 2 comments
Open

[SR-4581] Optimizer doesn't elide copy #47158

milseman mannequin opened this issue Apr 13, 2017 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance

Comments

@milseman
Copy link
Mannequin

milseman mannequin commented Apr 13, 2017

Previous ID SR-4581
Radar None
Original Reporter @milseman
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Performance
Assignee None
Priority Medium

md5: 46bed9a52535fd82e23b496236cbdb9e

Issue Description:

In the provided implementation of a fixed size array, using UnsafeBufferPointers for get/set subscript, the compiler doesn't elide the copy into a temporary in the getter. Unfortunately, the copy is necessary for Swift's type system while also maintaining conformance to UnsafeMutableCollection.

I have attached the Swift code and the post-optimization LLVM IR.

Note: it's inline(never) to demonstrate that the optimization is not happening locally.

@milseman
Copy link
Mannequin Author

milseman mannequin commented Apr 13, 2017

aschwaighofer@apple.com (JIRA User) @eeckstein, if the fix is difficult, then feel free to prioritize this lower than other optimizations, as there's still plenty of other more significant overhead to investigate elsewhere.

@gottesmm
Copy link
Member

@milseman In the future, can you post the sil as well?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance
Projects
None yet
Development

No branches or pull requests

1 participant