mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Beyond allowing us to emit better errors, this will allow me to (in a subsequent commit) count the amount of uses that are "outside" of the linear lifetime. I can then compare that against a passed in set of "non consuming uses". If the count of the number of uses "outside" of the linear lifetime equals the count of the passed in set of "non consuming uses", then I know that /all/ non consuming uses that I am testing against are not co-incident with the linear lifetime, meaning that they can not effect (in a local, direct sense) the linear lifetime. I am going to use that information to determine when it is safe to convert an inout form a load [copy] to a load_borrow in the face of local mutations. I can pass the set of local mutations as non-consuming uses to a linear lifetime consisting of the load [copy]/destroy_values and thus prove that no writes occur in between the load [copy]/destroy_value meaning it is safe to conver them to borrow form. NOTE: The aforementioned optimization is an extension of an optimization already in tree that just bails if we have any writes to an inout locally, which is so unfortunate.
9.7 KiB
9.7 KiB