[SR-4581] Optimizer doesn't elide copy #47158
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
performance
Attachment: Download
Additional Detail from JIRA
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.
The text was updated successfully, but these errors were encountered: