mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This updates how we model reborrow's lifetimes for ownership verification. Today we follow and combine a borrow's lifetime through phi args as well. Owned values lifetimes end at a phi arg. This discrepency in modeling lifetimes leads to the OwnershipVerifier raising errors incorrectly for cases such as this, where the borrow and the base value do not dominate the end_borrow: bb0: cond_br undef, bb1, bb2 bb1: %copy0 = copy_value %0 %borrow0 = begin_borrow %copy0 br bb3(%borrow0, %copy0) bb2: %copy1 = copy_value %1 %borrow1 = begin_borrow %copy1 br bb3(%borrow1, %copy1) bb3(%borrow, %baseVal): end_borrow %borrow destroy_value %baseVal This PR adds a new ReborrowVerifier. The ownership verifier collects borrow's lifetime ending users and populates the worklist of the ReborrowVerifier with reborrows and the corresponding base value. ReborrowVerifier then verifies that the lifetime of the reborrow is within the lifetime of the base value.
8 lines
186 B
CMake
8 lines
186 B
CMake
target_sources(swiftSIL PRIVATE
|
|
LoadBorrowImmutabilityChecker.cpp
|
|
LinearLifetimeChecker.cpp
|
|
MemoryLifetime.cpp
|
|
ReborrowVerifier.cpp
|
|
SILOwnershipVerifier.cpp
|
|
SILVerifier.cpp)
|