Skip to content

Commit 5e0267b

Browse files
Merge pull request #64553 from nate-chandler/eagermove_collections
[stdlib] Collection types are eagerMove.
2 parents 9039a29 + ff3ec19 commit 5e0267b

22 files changed

+123
-99
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ObjCBridgingOptimization.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,14 @@ private func removeBridgingCodeInPredecessors(of block: BasicBlock, _ context: F
246246
}
247247

248248
private func lookThroughOwnershipInsts(_ value: Value) -> Value {
249-
// Looks like it's sufficient to support begin_borrow for now.
250-
// TODO: add copy_value if needed.
249+
// Looks like it's sufficient to support begin_borrow and copy_value for now.
250+
// TODO: add move_value if needed.
251251
if let bbi = value as? BeginBorrowInst {
252252
return bbi.borrowedValue
253253
}
254+
if let cvi = value as? CopyValueInst {
255+
return cvi.fromValue
256+
}
254257
return value
255258
}
256259

lib/SIL/IR/TypeLowering.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,16 +2758,16 @@ bool TypeConverter::visitAggregateLeaves(
27582758
packIndex);
27592759
}
27602760
} else if (auto tupleTy = ty->getAs<TupleType>()) {
2761-
for (unsigned tupleIndex = 0, num = tupleTy->getNumElements();
2762-
tupleIndex < num; ++tupleIndex) {
2763-
auto origElementTy = origTy.getTupleElementType(tupleIndex);
2764-
auto substElementTy =
2765-
tupleTy->getElementType(tupleIndex)->getCanonicalType();
2766-
substElementTy =
2767-
computeLoweredRValueType(context, origElementTy, substElementTy);
2768-
insertIntoWorklist(substElementTy, origElementTy, nullptr,
2769-
tupleIndex);
2770-
}
2761+
unsigned tupleIndex = 0;
2762+
origTy.forEachExpandedTupleElement(
2763+
CanTupleType(tupleTy),
2764+
[&](auto origElementTy, auto substElementTy, auto element) {
2765+
substElementTy =
2766+
substOpaqueTypesWithUnderlyingTypes(substElementTy, context);
2767+
insertIntoWorklist(substElementTy, origElementTy, nullptr,
2768+
tupleIndex);
2769+
++tupleIndex;
2770+
});
27712771
} else if (auto *decl = ty->getStructOrBoundGenericStruct()) {
27722772
for (auto *structField : decl->getStoredProperties()) {
27732773
auto subMap = ty->getContextSubstitutionMap(&M, decl);

stdlib/public/core/Array.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@
297297
/// instances of those types always have a contiguous block of memory as
298298
/// their storage.
299299
@frozen
300+
@_eagerMove
300301
public struct Array<Element>: _DestructorSafeContainer {
301302
#if _runtime(_ObjC)
302303
@usableFromInline

stdlib/public/core/ContiguousArray.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
/// For more information about using arrays, see `Array` and `ArraySlice`, with
3535
/// which `ContiguousArray` shares most properties and methods.
3636
@frozen
37+
@_eagerMove
3738
public struct ContiguousArray<Element>: _DestructorSafeContainer {
3839
@usableFromInline
3940
internal typealias _Buffer = _ContiguousArrayBuffer<Element>

stdlib/public/core/Dictionary.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@
386386
/// optimization that is used when two instances of `Dictionary` share
387387
/// buffer.
388388
@frozen
389+
@_eagerMove
389390
public struct Dictionary<Key: Hashable, Value> {
390391
/// The element type of a dictionary: a tuple containing an individual
391392
/// key-value pair.

stdlib/public/core/Set.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
/// same copy-on-write optimization that is used when two instances of `Set`
145145
/// share buffer.
146146
@frozen
147+
@_eagerMove
147148
public struct Set<Element: Hashable> {
148149
@usableFromInline
149150
internal var _variant: _Variant

stdlib/public/core/String.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ internal func unimplemented_utf8_32bit(
349349
/// [scalars]: http://www.unicode.org/glossary/#unicode_scalar_value
350350
/// [equivalence]: http://www.unicode.org/glossary/#canonical_equivalent
351351
@frozen
352+
@_eagerMove
352353
public struct String {
353354
public // @SPI(Foundation)
354355
var _guts: _StringGuts

test/AutoDiff/SILOptimizer/activity_analysis.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,26 +350,26 @@ func testArrayUninitializedIntrinsicNested(_ x: Float, _ y: Float) -> [Float] {
350350
// CHECK: [ACTIVE] [[ARRAY:%.*]] = apply %14<Float>(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0>
351351
// CHECK: [USEFUL] [[INT_LIT:%.*]] = integer_literal $Builtin.Word, 2
352352
// CHECK: [NONE] // function_ref _allocateUninitializedArray<A>(_:)
353-
// CHECK: [ACTIVE] [[TUP:%.*]] = apply %19<Float>([[INT_LIT]]) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)
353+
// CHECK: [ACTIVE] [[TUP:%.*]] = apply %18<Float>([[INT_LIT]]) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)
354354
// CHECK: [ACTIVE] (**[[LHS:%.*]]**, [[RHS:%.*]]) = destructure_tuple [[TUP]] : $(Array<Float>, Builtin.RawPointer)
355355
// CHECK: [VARIED] ([[LHS]], **[[RHS]]**) = destructure_tuple [[TUP]] : $(Array<Float>, Builtin.RawPointer)
356356
// CHECK: [ACTIVE] [[FLOAT_PTR:%.*]] = pointer_to_address [[RHS]] : $Builtin.RawPointer to [strict] $*Float
357357
// CHECK: [USEFUL] [[ZERO_LITERAL:%.*]] = integer_literal $Builtin.IntLiteral, 0
358358
// CHECK: [USEFUL] [[META:%.*]] = metatype $@thin Int.Type
359359
// CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:)
360-
// CHECK: [USEFUL] [[RESULT_2:%.*]] = apply %26([[ZERO_LITERAL]], [[META]]) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
360+
// CHECK: [USEFUL] [[RESULT_2:%.*]] = apply %25([[ZERO_LITERAL]], [[META]]) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
361361
// CHECK: [NONE] // function_ref Array.subscript.getter
362-
// CHECK: [NONE] %29 = apply %28<Float>([[FLOAT_PTR]], [[RESULT_2]], %16) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
362+
// CHECK: [NONE] %28 = apply %27<Float>([[FLOAT_PTR]], [[RESULT_2]], %15) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
363363
// CHECK: [VARIED] [[ONE_LITERAL:%.*]] = integer_literal $Builtin.Word, 1
364364
// CHECK: [ACTIVE] [[INDEX_ADDR:%.*]] = index_addr [[FLOAT_PTR]] : $*Float, [[ONE_LITERAL]] : $Builtin.Word
365365
// CHECK: [USEFUL] [[ONE_LITERAL_AGAIN:%.*]] = integer_literal $Builtin.IntLiteral, 1
366366
// CHECK: [USEFUL] [[META_AGAIN:%.*]] = metatype $@thin Int.Type
367367
// CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:)
368-
// CHECK: [USEFUL] %35 = apply %34([[ONE_LITERAL_AGAIN]], [[META_AGAIN]]) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
368+
// CHECK: [USEFUL] %34 = apply %33([[ONE_LITERAL_AGAIN]], [[META_AGAIN]]) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
369369
// CHECK: [NONE] // function_ref Array.subscript.getter
370-
// CHECK: [NONE] %37 = apply %36<Float>(%31, %35, %16) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
370+
// CHECK: [NONE] %36 = apply %35<Float>(%30, %34, %15) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
371371
// CHECK: [NONE] // function_ref _finalizeUninitializedArray<A>(_:)
372-
// CHECK: [ACTIVE] %39 = apply %38<Float>(%21) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0>
372+
// CHECK: [ACTIVE] %38 = apply %37<Float>(%20) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0>
373373

374374
// TF-978: Test array literal initialized with `apply` indirect results.
375375
struct Wrapper<T: Differentiable>: Differentiable {
@@ -617,7 +617,7 @@ func testBeginApplyActiveInoutArgument(array: [Float], x: Float) -> Float {
617617
// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveInoutArgument{{.*}} at parameter indices (0, 1) and result indices (0)
618618
// CHECK: [ACTIVE] %0 = argument of bb0 : $Array<Float>
619619
// CHECK: [ACTIVE] %1 = argument of bb0 : $Float
620-
// CHECK: [ACTIVE] %4 = alloc_stack [lexical] $Array<Float>, var, name "array"
620+
// CHECK: [ACTIVE] %4 = alloc_stack $Array<Float>, var, name "array"
621621
// CHECK: [ACTIVE] %5 = copy_value %0 : $Array<Float>
622622
// CHECK: [USEFUL] %7 = integer_literal $Builtin.IntLiteral, 0
623623
// CHECK: [USEFUL] %8 = metatype $@thin Int.Type
@@ -654,7 +654,7 @@ func testBeginApplyActiveButInitiallyNonactiveInoutArgument(x: Float) -> Float {
654654

655655
// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveButInitiallyNonactiveInoutArgument{{.*}} at parameter indices (0) and result indices (0)
656656
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
657-
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Array<Float>, var, name "array"
657+
// CHECK: [ACTIVE] %2 = alloc_stack $Array<Float>, var, name "array"
658658
// CHECK: [USEFUL] %3 = integer_literal $Builtin.Word, 1
659659
// CHECK: [NONE] // function_ref _allocateUninitializedArray<A>(_:)
660660
// CHECK: [USEFUL] %5 = apply %4<Float>(%3) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)

test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ func modify(_ s: Struct, _ x: Float) -> Float {
716716
func tupleArrayLiteralInitialization(_ x: Float, _ y: Float) -> Float {
717717
// `Array<(Float, Float)>` does not conform to `Differentiable`.
718718
let array = [(x * y, x * y)]
719-
// expected-note @-1 {{cannot differentiate through a non-differentiable argument; do you want to use 'withoutDerivative(at:)'?}} {{7-7=withoutDerivative(at: }} {{12-12=)}}
719+
// expected-note @-1 {{cannot differentiate through a non-differentiable argument; do you want to use 'withoutDerivative(at:)'?}} {{15-15=withoutDerivative(at: }} {{31-31=)}}
720720
return array[0].0
721721
}
722722

test/SILGen/consuming_parameter.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ func bar(_: String) {}
66
func foo(y: consuming String, z: String) -> () -> String {
77
// CHECK: bb0(%0 : @owned $String, %1 : @guaranteed $String):
88
// CHECK: [[BOX:%.*]] = alloc_box ${ var String }
9-
// CHECK: [[BOX1:%.*]] = begin_borrow [lexical] [[BOX]]
10-
// CHECK: [[Y:%.*]] = project_box [[BOX1]]
9+
// CHECK: [[Y:%.*]] = project_box [[BOX]]
1110
// CHECK: store %0 to [init] [[Y]]
1211

13-
// CHECK: [[YCAPTURE:%.*]] = copy_value [[BOX1]]
12+
// CHECK: [[YCAPTURE:%.*]] = copy_value [[BOX]]
1413
// CHECK: partial_apply {{.*}} {{%.*}}([[YCAPTURE]])
1514
let r = { y }
1615

@@ -36,11 +35,10 @@ struct Butt {
3635
consuming func merged(with other: Butt) -> () -> Butt {
3736
// CHECK: bb0(%0 : @guaranteed $Butt, %1 : @owned $Butt):
3837
// CHECK: [[BOX:%.*]] = alloc_box ${ var Butt }
39-
// CHECK: [[BOX1:%.*]] = begin_borrow [lexical] [[BOX]]
40-
// CHECK: [[SELF:%.*]] = project_box [[BOX1]]
38+
// CHECK: [[SELF:%.*]] = project_box [[BOX]]
4139
// CHECK: store %1 to [init] [[SELF]]
4240

43-
// CHECK: [[SELFCAPTURE:%.*]] = copy_value [[BOX1]]
41+
// CHECK: [[SELFCAPTURE:%.*]] = copy_value [[BOX]]
4442
// CHECK: partial_apply {{.*}} {{%.*}}([[SELFCAPTURE]])
4543
let r = { self }
4644

test/SILGen/foreach.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ protocol GenericCollection : Collection {
5353
// CHECK-LABEL: sil hidden [ossa] @$s7foreach13trivialStructyySaySiGF : $@convention(thin) (@guaranteed Array<Int>) -> () {
5454
// CHECK: bb0([[ARRAY:%.*]] : @guaranteed $Array<Int>):
5555
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var IndexingIterator<Array<Int>> }, var, name "$x$generator"
56-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
57-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
56+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
5857
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
5958
//
6059
// CHECK: [[LOOP_DEST]]:
@@ -66,7 +65,6 @@ protocol GenericCollection : Collection {
6665
// CHECK: br [[LOOP_DEST]]
6766
//
6867
// CHECK: [[NONE_BB]]:
69-
// CHECK: end_borrow [[ITERATOR_LIFETIME]]
7068
// CHECK: destroy_value [[ITERATOR_BOX]]
7169
// CHECK: [[FUNC_END_FUNC:%.*]] = function_ref @funcEnd : $@convention(thin) () -> ()
7270
// CHECK: apply [[FUNC_END_FUNC]]()
@@ -107,8 +105,7 @@ func trivialStructBreak(_ xx: [Int]) {
107105
// CHECK-LABEL: sil hidden [ossa] @$s7foreach26trivialStructContinueBreakyySaySiGF : $@convention(thin) (@guaranteed Array<Int>) -> () {
108106
// CHECK: bb0([[ARRAY:%.*]] : @guaranteed $Array<Int>):
109107
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var IndexingIterator<Array<Int>> }, var, name "$x$generator"
110-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
111-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
108+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
112109
// CHECK: [[BORROWED_ARRAY_STACK:%.*]] = alloc_stack $Array<Int>
113110
// CHECK: store [[ARRAY_COPY:%.*]] to [init] [[BORROWED_ARRAY_STACK]]
114111
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0>
@@ -148,7 +145,6 @@ func trivialStructBreak(_ xx: [Int]) {
148145
// CHECK: br [[CONT_BLOCK]]
149146
//
150147
// CHECK: [[CONT_BLOCK]]
151-
// CHECK: end_borrow [[ITERATOR_LIFETIME]]
152148
// CHECK: destroy_value [[ITERATOR_BOX]] : ${ var IndexingIterator<Array<Int>> }
153149
// CHECK: [[FUNC_END_FUNC:%.*]] = function_ref @funcEnd : $@convention(thin) () -> ()
154150
// CHECK: apply [[FUNC_END_FUNC]]()
@@ -209,8 +205,7 @@ func existentialBreak(_ xx: [P]) {
209205
// CHECK-LABEL: sil hidden [ossa] @$s7foreach24existentialContinueBreakyySayAA1P_pGF : $@convention(thin) (@guaranteed Array<any P>) -> () {
210206
// CHECK: bb0([[ARRAY:%.*]] : @guaranteed $Array<any P>):
211207
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var IndexingIterator<Array<any P>> }, var, name "$x$generator"
212-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
213-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
208+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
214209
// CHECK: [[BORROWED_ARRAY_STACK:%.*]] = alloc_stack $Array<any P>
215210
// CHECK: store [[ARRAY_COPY:%.*]] to [init] [[BORROWED_ARRAY_STACK]]
216211
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0>
@@ -259,7 +254,6 @@ func existentialBreak(_ xx: [P]) {
259254
//
260255
// CHECK: [[CONT_BLOCK]]
261256
// CHECK: dealloc_stack [[ELT_STACK]]
262-
// CHECK: end_borrow [[ITERATOR_LIFETIME]]
263257
// CHECK: destroy_value [[ITERATOR_BOX]] : ${ var IndexingIterator<Array<any P>> }
264258
// CHECK: [[FUNC_END_FUNC:%.*]] = function_ref @funcEnd : $@convention(thin) () -> ()
265259
// CHECK: apply [[FUNC_END_FUNC]]()
@@ -371,8 +365,7 @@ func genericStructBreak<T>(_ xx: [GenericStruct<T>]) {
371365
// CHECK-LABEL: sil hidden [ossa] @$s7foreach26genericStructContinueBreakyySayAA07GenericC0VyxGGlF : $@convention(thin) <T> (@guaranteed Array<GenericStruct<T>>) -> () {
372366
// CHECK: bb0([[ARRAY:%.*]] : @guaranteed $Array<GenericStruct<T>>):
373367
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box $<τ_0_0> { var IndexingIterator<Array<GenericStruct<τ_0_0>>> } <T>, var, name "$x$generator"
374-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
375-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
368+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
376369
// CHECK: [[BORROWED_ARRAY_STACK:%.*]] = alloc_stack $Array<GenericStruct<T>>
377370
// CHECK: store [[ARRAY_COPY:%.*]] to [init] [[BORROWED_ARRAY_STACK]]
378371
// CHECK: [[MAKE_ITERATOR_FUNC:%.*]] = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0>
@@ -421,7 +414,6 @@ func genericStructBreak<T>(_ xx: [GenericStruct<T>]) {
421414
//
422415
// CHECK: [[CONT_BLOCK]]
423416
// CHECK: dealloc_stack [[ELT_STACK]]
424-
// CHECK: end_borrow [[ITERATOR_LIFETIME]]
425417
// CHECK: destroy_value [[ITERATOR_BOX]]
426418
// CHECK: [[FUNC_END_FUNC:%.*]] = function_ref @funcEnd : $@convention(thin) () -> ()
427419
// CHECK: apply [[FUNC_END_FUNC]]()

test/SILGen/foreach_async.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ struct AsyncLazySequence<S: Sequence>: AsyncSequence {
7474
// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async13trivialStructyyAA17AsyncLazySequenceVySaySiGGYaF : $@convention(thin) @async (@guaranteed AsyncLazySequence<Array<Int>>) -> () {
7575
// CHECK: bb0([[SOURCE:%.*]] : @guaranteed $AsyncLazySequence<Array<Int>>):
7676
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var AsyncLazySequence<Array<Int>>.Iterator }, var, name "$x$generator"
77-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
78-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
77+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
7978
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
8079

8180
// CHECK: [[LOOP_DEST]]:
@@ -104,8 +103,7 @@ func trivialStruct(_ xx: AsyncLazySequence<[Int]>) async {
104103
// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async21trivialStructContinueyyAA17AsyncLazySequenceVySaySiGGYaF : $@convention(thin) @async (@guaranteed AsyncLazySequence<Array<Int>>) -> () {
105104
// CHECK: bb0([[SOURCE:%.*]] : @guaranteed $AsyncLazySequence<Array<Int>>):
106105
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var AsyncLazySequence<Array<Int>>.Iterator }, var, name "$x$generator"
107-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
108-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
106+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
109107
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
110108

111109
// CHECK: [[LOOP_DEST]]:
@@ -161,8 +159,7 @@ func trivialStructBreak(_ xx: AsyncLazySequence<[Int]>) async {
161159
// CHECK-LABEL: sil hidden [ossa] @$s13foreach_async26trivialStructContinueBreakyyAA17AsyncLazySequenceVySaySiGGYaF : $@convention(thin) @async (@guaranteed AsyncLazySequence<Array<Int>>) -> ()
162160
// CHECK: bb0([[SOURCE:%.*]] : @guaranteed $AsyncLazySequence<Array<Int>>):
163161
// CHECK: [[ITERATOR_BOX:%.*]] = alloc_box ${ var AsyncLazySequence<Array<Int>>.Iterator }, var, name "$x$generator"
164-
// CHECK: [[ITERATOR_LIFETIME:%[^,]+]] = begin_borrow [lexical] [[ITERATOR_BOX]]
165-
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_LIFETIME]]
162+
// CHECK: [[PROJECT_ITERATOR_BOX:%.*]] = project_box [[ITERATOR_BOX]]
166163
// CHECK: br [[LOOP_DEST:bb[0-9]+]]
167164

168165
// CHECK: [[LOOP_DEST]]:

0 commit comments

Comments
 (0)