File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
SwiftCompilerSources/Sources/Optimizer/Utilities Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,12 @@ extension AddressUseVisitor {
139139 let svi = operand. instruction as! SingleValueInstruction
140140 return loadedAddressUse ( of: operand, intoValue: svi)
141141
142- case is YieldInst :
142+ case is YieldInst ,
143+ // Return should only occur in a borrow or inout accessor, in which case the
144+ // returned address should be structurally used as if it were a projected
145+ // use in the caller, even though there is no code here in the callee to
146+ // formally end the access.
147+ is ReturnInst :
143148 return yieldedAddressUse ( of: operand)
144149
145150 case let sdai as SourceDestAddrInstruction
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-emit-sil -enable-experimental-feature Lifetimes -enable-experimental-feature BorrowAndMutateAccessors -verify %s
2+
3+ // REQUIRES: swift_feature_Lifetimes
4+ // REQUIRES: swift_feature_BorrowAndMutateAccessors
5+
6+ struct Butt < T: ~ Escapable> : ~ Escapable {
7+ var x : T
8+
9+ var xx : T {
10+ @_lifetime ( copy self)
11+ borrow {
12+ return x
13+ }
14+ }
15+ }
16+
17+ struct Tubb < T> : ~ Escapable {
18+ var x : T
19+
20+ @_lifetime ( immortal)
21+ init ( ) { fatalError ( ) }
22+
23+ var xx : T {
24+ borrow {
25+ return x
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments