CoW test loop hoisting

What do I need to do to get the swift compiler to hoist the CoW check of my custom CoW type out of loops?

As you can see here the hoisting works fine with [UInt8] but not with my simple CoW buffer

This might be due to Array's use of @_semantics, in which case it may be difficult to replicate. Ideally the compiler would be smart enough to not need that, but in practice…

3 Likes

@David_Smith you are correct. We would need a way at the language level to provide this information to the optimizer. Partly this is b/c there are special requirements around the optimization, but in principle we should be able to do it.

5 Likes
Terms of Service

Privacy Policy

Cookie Policy