Skip to content

Commit d0f58b7

Browse files
committed
Fix unit tests after enabling trivial lifetime dependence.
A trivial value that is marked dependent on the access scope of another trivial variable is escaping of its use is outside the access scope.
1 parent 6084567 commit d0f58b7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test/SILGen/addressors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func test1() -> Int32 {
9797
// CHECK: [[PTR:%.*]] = apply [[ACCESSOR]]({{%.*}}, [[A]]) : $@convention(method) (Int32, A) -> UnsafePointer<Int32>
9898
// CHECK: [[T0:%.*]] = struct_extract [[PTR]] : $UnsafePointer<Int32>, #UnsafePointer._rawValue
9999
// CHECK: [[T1:%.*]] = pointer_to_address [[T0]] : $Builtin.RawPointer to [strict] $*Int32
100-
// CHECK: [[MD:%.*]] = mark_dependence [nonescaping] [[T1]] : $*Int32 on [[A]] : $A
100+
// CHECK: [[MD:%.*]] = mark_dependence [[T1]] : $*Int32 on [[A]] : $A
101101
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unsafe] [[MD]] : $*Int32
102102
// CHECK: [[T2:%.*]] = load [[ACCESS]] : $*Int32
103103
// CHECK: return [[T2]] : $Int32

test/SILOptimizer/unsafeAddress.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,15 @@ func testSMod(s: inout S) {
9595
mod(&s.mutableData)
9696
}
9797

98+
// Accessing s.data causes an escaping dependence because we don't extend the local access scope of 's'.
99+
//
100+
// TODO: could we notice the local access is already nested inside the same kind of access (modify) and consider this to
101+
// be 'mark_dependence [nonescaping]'?
102+
//
98103
// CHECK-LABEL: sil hidden @$s4main16testSInoutBorrow5mut_syAA1SVz_tF : $@convention(thin) (@inout S) -> () {
99104
// CHECK: [[ACCESS:%.*]] = begin_access [read] [static] %0
100105
// CHECK: [[ADR:%.*]] = pointer_to_address %{{.*}} to [strict] $*NC
101-
// CHECK: [[MD:%.*]] = mark_dependence [nonescaping] [[ADR]] on [[ACCESS]]
106+
// CHECK: [[MD:%.*]] = mark_dependence [[ADR]] on [[ACCESS]]
102107
// CHECK: begin_access [read] [unsafe] [[MD]]
103108
// CHECK: apply
104109
// CHECK: end_access

0 commit comments

Comments
 (0)