mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is an improvement of #67031 which avoids deleting the closure function body during AllocBoxToStack, which still breaks pass invariants by modifying functions other than the currently-analyzed function. As a function pass, AllocBoxToStack also doesn't really know with certainty whether the original closure function is unused after stack promotion or not. We still want to eliminate the original when it may contain invalid SIL for move-only values that rely on the escape analysis for correct semantics, so rather than mark the original function to be *ignored* during move-only checking, mark it to be *deleted* by move-only checking if the function is in fact unused at that point. If the marked function is still used, we let it pass through move-only checking normally, which may cause redundant diagnostics but is the right thing to do since code is still potentially using the closure with escaping semantics. We should rearrange things to make this situation impossible in the future. rdar://110675352
9.1 KiB
9.1 KiB