Uploaded image for project: 'Swift'
  1. Swift
  2. SR-4581

Optimizer doesn't elide copy

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:

      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.

        Attachments

        1. fixedArray.swift
          2 kB
        2. foo.ll
          610 kB

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            milseman Michael Ilseman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: