> On Wed, Nov 16, 2016 at 12:01 AM Michael Gottesman <mgottes...@apple.com> > wrote: >> On Nov 15, 2016, at 8:54 PM, Ben Ng <m...@benng.me> wrote: >> >> Hi Michael, >> >> It can probably be stuck in the Array Value Propagation pass since its >> pretty similar. Yes, it uses Array semantics. I isolated it in a separate >> file because it's my first time working on the Swift compiler and I wanted >> to keep the moving parts to a minimum. > > Ok. I was just saying this transformation is small enough it probably makes > sense not to have a pass just for it. That is all.
It makes sense for this to eventually be part of array value propagation. I think you will reuse some code that is in there (probably most of “ArrayAllocation” to get at the element of the appended array). As I understand, you are going to transform: var a = […] a += [1] // Really, by the time you look at this in array value prop // this call should have been inline and you would see a call // to: // a.append(contentsOf: [1]) to var a = […] a.append(1) I agree with Roman that you should emit a call to the unspecialized “append(_:)” method and be able to rely on later specialization passes to clean up the unspecialized code. _______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev