[swift-dev] High-level SIL Optimization: How do I get a FuncRef from the stdlib?
Arnold Schwaighofer
aschwaighofer at apple.com
Wed Nov 16 11:22:49 CST 2016
> On Wed, Nov 16, 2016 at 12:01 AM Michael Gottesman <mgottesman at apple.com> wrote:
>> On Nov 15, 2016, at 8:54 PM, Ben Ng <me at 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.
More information about the swift-dev
mailing list