Files
swift-mirror/lib/SILOptimizer/Mandatory/MoveOnlyBorrowToDestructureUtils.cpp
Michael Gottesman 9b59588fc3 [move-only] If we have a guaranteed forwarding instruction with only trivial results, treat it as a liveness use.
The reason why we want to do this is that if we treat it as a true forwarding
use, we will visit the uses of the trivial value and treat those as liveness
uses. Since the trivial value is not tied to the lifetime of the underlying
noncopyable value, this can be outside of the lifetime of said value causing a
memory lifetime error. By just treating the guaranteed forwarding instruction
with all trivial values as a liveness use, we avoid this problem.

I added a SIL test, a Swift test, and an Interpreter test that validates this
behavior.

rdar://111497657
2023-06-29 00:00:05 -07:00

73 KiB