mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fixes a bug in MandatoryDestroyHoisting where a captured value is destroyed before a copy of the closure. On-stack closures can be copied, and all copied uses must be within the borrow scope of the captured operand. This is just like any other non-Escapable value, so treat it as such by checking `Value.mayEscape` rather than `Type.Escapable`. Originally, I wanted to make it illegal to copy of partial_apply [on_stack], but it looks like we still allow it. I would rather not complicate any logic yet with special handling for this case. To fix any performance concerns, we might be able to simplify the representation instead by banning copy_value on on-stack closures. Fixes rdar://165850554 swift-frontend crash: While running "CopyPropagation" - Invalid SIL provided to OSSACompleteLifetime?!)
36 KiB
36 KiB