1
- // RUN: %target-sil-opt %s -onone-simplification -simplify-instruction=mark_dependence -enable-experimental-feature LifetimeDependence | %FileCheck %s
1
+ // RUN: %target-sil-opt %s -onone-simplification -simplify-instruction=mark_dependence -enable-experimental-feature Lifetimes | %FileCheck %s
2
2
3
- // REQUIRES: swift_feature_LifetimeDependence
3
+ // REQUIRES: swift_feature_Lifetimes
4
4
5
5
import Swift
6
6
import Builtin
@@ -14,10 +14,20 @@ struct S {
14
14
15
15
struct NE: ~Escapable {}
16
16
17
+ struct NEHolder : ~Escapable {
18
+ var ne: NE {
19
+ @_lifetime(borrow self)
20
+ get
21
+ }
22
+ }
23
+
17
24
struct S2: ~Escapable {
18
25
var a: NE
19
26
}
20
27
28
+ sil @read_ne : $@yield_once @convention(method) (@guaranteed NEHolder) -> @lifetime(borrow 0) @yields @guaranteed NE
29
+ sil @use_ne : $@convention(thin) (@guaranteed NE) -> ()
30
+
21
31
// CHECK-LABEL: sil [ossa] @mark_dependence_trivial_base :
22
32
// CHECK: %2 = copy_value %0
23
33
// CHECK-NEXT: return %2
@@ -155,3 +165,26 @@ bb0(%0 : $*Builtin.Int64, %1 : $B):
155
165
return %5
156
166
}
157
167
168
+ // CHECK-LABEL: sil hidden [ossa] @testChainedDependence : $@convention(thin) (@guaranteed NEHolder) -> () {
169
+ // CHECK: bb0(%0 : @noImplicitCopy @guaranteed $NEHolder):
170
+ // CHECK: ([[YIELD:%[0-9]+]], [[TOKEN:%[0-9]+]]) = begin_apply %2(%1) : $@yield_once @convention(method) (@guaranteed NEHolder) -> @lifetime(borrow 0) @yields @guaranteed NE
171
+ // CHECK: [[MD1:%[0-9]+]] = mark_dependence [nonescaping] [[YIELD]] on [[TOKEN]]
172
+ // CHECK: mark_dependence [nonescaping] [[MD1]] on
173
+ // CHECK-LABEL: } // end sil function 'testChainedDependence'
174
+ sil hidden [ossa] @testChainedDependence : $@convention(thin) (@guaranteed NEHolder) -> () {
175
+ bb0(%0 : @noImplicitCopy @guaranteed $NEHolder):
176
+ %2 = begin_borrow %0
177
+ %3 = function_ref @read_ne : $@yield_once @convention(method) (@guaranteed NEHolder) -> @lifetime(borrow 0) @yields @guaranteed NE
178
+ (%4, %5) = begin_apply %3(%2) : $@yield_once @convention(method) (@guaranteed NEHolder) -> @lifetime(borrow 0) @yields @guaranteed NE
179
+ %6 = mark_dependence [nonescaping] %4 on %5
180
+ %7 = mark_dependence [nonescaping] %6 on %2
181
+ %8 = copy_value %7
182
+ %9 = move_value [var_decl] %8
183
+ %11 = function_ref @use_ne : $@convention(thin) (@guaranteed NE) -> ()
184
+ %12 = apply %11(%9) : $@convention(thin) (@guaranteed NE) -> ()
185
+ destroy_value %9
186
+ %14 = end_apply %5 as $()
187
+ end_borrow %2
188
+ %16 = tuple ()
189
+ return %16
190
+ }
0 commit comments