Skip to content

Commit 39f1001

Browse files
authored
Merge pull request #66717 from nate-chandler/cherrypick/release/5.9/rdar110901430
5.9: [TypeLowering] Move-only types are lexical.
2 parents a00e181 + 3fd7d10 commit 39f1001

File tree

8 files changed

+139
-56
lines changed

8 files changed

+139
-56
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,7 @@ namespace {
23942394

23952395
if (D->isMoveOnly()) {
23962396
properties.setNonTrivial();
2397+
properties.setLexical(IsLexical);
23972398
if (properties.isAddressOnly())
23982399
return handleMoveOnlyAddressOnly(structType, properties);
23992400
return new (TC) MoveOnlyLoadableStructTypeLowering(
@@ -2475,6 +2476,7 @@ namespace {
24752476

24762477
if (D->isMoveOnly()) {
24772478
properties.setNonTrivial();
2479+
properties.setLexical(IsLexical);
24782480
if (properties.isAddressOnly())
24792481
return handleMoveOnlyAddressOnly(enumType, properties);
24802482
return new (TC)
@@ -4621,6 +4623,12 @@ void TypeLowering::print(llvm::raw_ostream &os) const {
46214623
<< "isFixedABI: " << BOOL(Properties.isFixedABI()) << ".\n"
46224624
<< "isAddressOnly: " << BOOL(Properties.isAddressOnly()) << ".\n"
46234625
<< "isResilient: " << BOOL(Properties.isResilient()) << ".\n"
4626+
<< "isTypeExpansionSensitive: "
4627+
<< BOOL(Properties.isTypeExpansionSensitive()) << ".\n"
4628+
<< "isInfinite: " << BOOL(Properties.isInfinite()) << ".\n"
4629+
<< "isOrContainsRawPointer: " << BOOL(Properties.isOrContainsRawPointer())
4630+
<< ".\n"
4631+
<< "isLexical: " << BOOL(Properties.isLexical()) << ".\n"
46244632
<< "\n";
46254633
}
46264634

lib/SILOptimizer/UtilityPasses/UnitTestRunner.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
#include "swift/SILOptimizer/Utils/InstructionDeleter.h"
9090
#include "swift/SILOptimizer/Utils/ParseTestSpecification.h"
9191
#include "llvm/ADT/StringRef.h"
92+
#include "llvm/Support/Debug.h"
9293
#include "llvm/Support/raw_ostream.h"
9394
#include <iterator>
9495
#include <memory>
@@ -287,6 +288,19 @@ struct OwnershipUtilsHasPointerEscape : UnitTest {
287288
}
288289
};
289290

291+
// Arguments:
292+
// - value: whose type will be printed
293+
// Dumps:
294+
// - the type lowering of the type
295+
struct PrintTypeLowering : UnitTest {
296+
PrintTypeLowering(UnitTestRunner *pass) : UnitTest(pass) {}
297+
void invoke(Arguments &arguments) override {
298+
auto value = arguments.takeValue();
299+
auto ty = value->getType();
300+
getFunction()->getTypeLowering(ty).print(llvm::dbgs());
301+
}
302+
};
303+
290304
//===----------------------------------------------------------------------===//
291305
// MARK: OSSA Lifetime Unit Tests
292306
//===----------------------------------------------------------------------===//
@@ -880,6 +894,7 @@ void UnitTestRunner::withTest(StringRef name, Doit doit) {
880894
ADD_UNIT_TEST_SUBCLASS("find-enclosing-defs", FindEnclosingDefsTest)
881895
ADD_UNIT_TEST_SUBCLASS("function-get-self-argument-index", FunctionGetSelfArgumentIndex)
882896
ADD_UNIT_TEST_SUBCLASS("has-pointer-escape", OwnershipUtilsHasPointerEscape)
897+
ADD_UNIT_TEST_SUBCLASS("print-type-lowering", PrintTypeLowering)
883898
ADD_UNIT_TEST_SUBCLASS("interior-liveness", InteriorLivenessTest)
884899
ADD_UNIT_TEST_SUBCLASS("is-deinit-barrier", IsDeinitBarrierTest)
885900
ADD_UNIT_TEST_SUBCLASS("is-lexical", IsLexicalTest)

test/SIL/type_lowering_unit.sil

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %target-sil-opt -unit-test-runner %s -o /dev/null 2>&1 | %FileCheck %s
2+
3+
sil_stage raw
4+
5+
import Builtin
6+
7+
struct S : ~Copyable {}
8+
9+
// CHECK-LABEL: begin {{.*}} print-type-lowering with: @argument[0]
10+
// CHECK: isLexical: true
11+
// CHECK-LABEL: end {{.*}} print-type-lowering with: @argument[0]
12+
sil [ossa] @move_only_argument : $@convention(thin) (@owned S) -> () {
13+
bb0(%0 : @owned $S):
14+
test_specification "print-type-lowering @argument[0]"
15+
destroy_value %0 : $S
16+
%retval = tuple ()
17+
return %retval : $()
18+
}

test/SILGen/discard.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ func invokedDeinit() {}
9191
// CHECK-LABEL: sil hidden [ossa] @$s4test11PointerTreeV10tryDestroy9doDiscardySb_tKF : $@convention(method) (Bool, @owned PointerTree) -> @error any Error {
9292
// CHECK: bb0{{.*}}:
9393
// CHECK: [[SELF_BOX:%.*]] = alloc_box ${ var PointerTree }, var, name "self"
94-
// CHECK: [[SELF_PTR:%.*]] = project_box [[SELF_BOX]] : ${ var PointerTree }, 0
94+
// CHECK: [[SELF_BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[SELF_BOX]]
95+
// CHECK: [[SELF_PTR:%.*]] = project_box [[SELF_BOX_LIFETIME]] : ${ var PointerTree }, 0
9596
// .. skip to the conditional test ..
9697
// CHECK: [[SHOULD_FORGET:%.*]] = struct_extract {{.*}} : $Bool, #Bool._value
9798
// CHECK: cond_br [[SHOULD_FORGET]], bb1, bb2
@@ -109,6 +110,7 @@ func invokedDeinit() {}
109110
// CHECK: br bb3
110111
//
111112
// CHECK: bb3:
113+
// CHECK: end_borrow [[SELF_BOX_LIFETIME]]
112114
// CHECK: destroy_value [[SELF_BOX]] : ${ var PointerTree }
113115
// CHECK: throw
114116
// CHECK: } // end sil function

test/SILGen/moveonly.swift

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ struct EmptyStruct {
933933
// CHECK-LABEL: sil hidden [ossa] @$s8moveonly11EmptyStructVACycfC : $@convention(method) (@thin EmptyStruct.Type) -> @owned EmptyStruct {
934934
// CHECK: [[BOX:%.*]] = alloc_box ${ var EmptyStruct }, var, name "self"
935935
// CHECK: [[MARKED_UNINIT:%.*]] = mark_uninitialized [rootself] [[BOX]]
936-
// CHECK: [[PROJECT:%.*]] = project_box [[MARKED_UNINIT]]
936+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[MARKED_UNINIT]]
937+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
937938
// CHECK: [[STRUCT:%.*]] = struct $EmptyStruct ()
938939
// CHECK: store [[STRUCT]] to [init] [[PROJECT]]
939940
// CHECK: [[MV_CHECK:%.*]] = mark_must_check [assignable_but_not_consumable] [[PROJECT]]
@@ -1039,7 +1040,8 @@ public struct LoadableSubscriptGetOnlyTester : ~Copyable {
10391040

10401041
// CHECK-LABEL: sil [ossa] @$s8moveonly047testSubscriptGetOnly_BaseLoadable_ResultAddressE4_VaryyF : $@convention(thin) () -> () {
10411042
// CHECK: [[BOX:%.*]] = alloc_box $
1042-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1043+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1044+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
10431045
//
10441046
// The get call
10451047
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -1077,7 +1079,8 @@ public func testSubscriptGetOnly_BaseLoadable_ResultAddressOnly_Var() {
10771079

10781080
// CHECK-LABEL: sil [ossa] @$s8moveonly047testSubscriptGetOnly_BaseLoadable_ResultAddressE4_LetyyF : $@convention(thin) () -> () {
10791081
// CHECK: [[BOX:%.*]] = alloc_box $
1080-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1082+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1083+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
10811084
//
10821085
// The get call
10831086
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
@@ -1140,7 +1143,8 @@ public struct LoadableSubscriptGetOnlyTesterNonCopyableStructParent : ~Copyable
11401143

11411144
// CHECK-LABEL: sil [ossa] @$s8moveonly077testSubscriptGetOnlyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressE4_VaryyF : $@convention(thin) () -> () {
11421145
// CHECK: [[BOX:%.*]] = alloc_box $
1143-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1146+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1147+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
11441148
//
11451149
// The first get call
11461150
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -1181,7 +1185,8 @@ public func testSubscriptGetOnlyThroughNonCopyableParentStruct_BaseLoadable_Resu
11811185

11821186
// CHECK-LABEL: sil [ossa] @$s8moveonly077testSubscriptGetOnlyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressE4_LetyyF : $@convention(thin) () -> () {
11831187
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
1184-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1188+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1189+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
11851190
//
11861191
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
11871192
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
@@ -1350,7 +1355,8 @@ public struct LoadableSubscriptGetSetTester : ~Copyable {
13501355

13511356
// CHECK-LABEL: sil [ossa] @$s8moveonly54testSubscriptGetSet_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
13521357
// CHECK: [[BOX:%.*]] = alloc_box $
1353-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1358+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1359+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
13541360
//
13551361
// The get call
13561362
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -1396,7 +1402,8 @@ public func testSubscriptGetSet_BaseLoadable_ResultAddressOnly_Var() {
13961402

13971403
// CHECK-LABEL: sil [ossa] @$s8moveonly54testSubscriptGetSet_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
13981404
// CHECK: [[BOX:%.*]] = alloc_box $
1399-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1405+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1406+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
14001407
//
14011408
// The get call
14021409
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
@@ -1507,7 +1514,8 @@ public struct LoadableSubscriptGetSetTesterNonCopyableStructParent : ~Copyable {
15071514

15081515
// CHECK-LABEL: sil [ossa] @$s8moveonly84testSubscriptGetSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
15091516
// CHECK: [[BOX:%.*]] = alloc_box $
1510-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1517+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1518+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
15111519
//
15121520
// The first get call
15131521
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -1561,7 +1569,8 @@ public func testSubscriptGetSetThroughNonCopyableParentStruct_BaseLoadable_Resul
15611569

15621570
// CHECK-LABEL: sil [ossa] @$s8moveonly84testSubscriptGetSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
15631571
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
1564-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1572+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1573+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
15651574
//
15661575
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
15671576
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
@@ -1819,7 +1828,8 @@ public struct LoadableSubscriptReadSetTester : ~Copyable {
18191828

18201829
// CHECK-LABEL: sil [ossa] @$s8moveonly55testSubscriptReadSet_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
18211830
// CHECK: [[BOX:%.*]] = alloc_box $
1822-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1831+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1832+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
18231833
//
18241834
// The read call
18251835
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -1865,7 +1875,8 @@ public func testSubscriptReadSet_BaseLoadable_ResultAddressOnly_Var() {
18651875

18661876
// CHECK-LABEL: sil [ossa] @$s8moveonly55testSubscriptReadSet_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
18671877
// CHECK: [[BOX:%.*]] = alloc_box $
1868-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1878+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1879+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
18691880
//
18701881
// The get call
18711882
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
@@ -1979,7 +1990,8 @@ public struct LoadableSubscriptReadSetTesterNonCopyableStructParent : ~Copyable
19791990

19801991
// CHECK-LABEL: sil [ossa] @$s8moveonly85testSubscriptReadSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
19811992
// CHECK: [[BOX:%.*]] = alloc_box $
1982-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
1993+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
1994+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
19831995
//
19841996
// The first get call
19851997
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -2031,7 +2043,8 @@ public func testSubscriptReadSetThroughNonCopyableParentStruct_BaseLoadable_Resu
20312043

20322044
// CHECK-LABEL: sil [ossa] @$s8moveonly85testSubscriptReadSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
20332045
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
2034-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2046+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2047+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
20352048
//
20362049
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
20372050
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
@@ -2285,7 +2298,8 @@ public struct LoadableSubscriptReadModifyTester : ~Copyable {
22852298

22862299
// CHECK-LABEL: sil [ossa] @$s8moveonly58testSubscriptReadModify_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
22872300
// CHECK: [[BOX:%.*]] = alloc_box $
2288-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2301+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2302+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
22892303
//
22902304
// The read call
22912305
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -2328,7 +2342,8 @@ public func testSubscriptReadModify_BaseLoadable_ResultAddressOnly_Var() {
23282342

23292343
// CHECK-LABEL: sil [ossa] @$s8moveonly58testSubscriptReadModify_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
23302344
// CHECK: [[BOX:%.*]] = alloc_box $
2331-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2345+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2346+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
23322347
//
23332348
// The get call
23342349
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
@@ -2431,7 +2446,8 @@ public struct LoadableSubscriptReadModifyTesterNonCopyableStructParent : ~Copyab
24312446

24322447
// CHECK-LABEL: sil [ossa] @$s8moveonly88testSubscriptReadModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
24332448
// CHECK: [[BOX:%.*]] = alloc_box $
2434-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2449+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2450+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
24352451
//
24362452
// The first get call
24372453
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -2477,7 +2493,8 @@ public func testSubscriptReadModifyThroughNonCopyableParentStruct_BaseLoadable_R
24772493

24782494
// CHECK-LABEL: sil [ossa] @$s8moveonly88testSubscriptReadModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
24792495
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
2480-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2496+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2497+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
24812498
//
24822499
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
24832500
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
@@ -2699,7 +2716,8 @@ public struct LoadableSubscriptGetModifyTester : ~Copyable {
26992716

27002717
// CHECK-LABEL: sil [ossa] @$s8moveonly57testSubscriptGetModify_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
27012718
// CHECK: [[BOX:%.*]] = alloc_box $
2702-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2719+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2720+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
27032721
//
27042722
// The get call
27052723
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -2743,7 +2761,8 @@ public func testSubscriptGetModify_BaseLoadable_ResultAddressOnly_Var() {
27432761

27442762
// CHECK-LABEL: sil [ossa] @$s8moveonly57testSubscriptGetModify_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
27452763
// CHECK: [[BOX:%.*]] = alloc_box $
2746-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2764+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2765+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
27472766
//
27482767
// The get call
27492768
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
@@ -2850,7 +2869,8 @@ public struct LoadableSubscriptGetModifyTesterNonCopyableStructParent : ~Copyabl
28502869

28512870
// CHECK-LABEL: sil [ossa] @$s8moveonly87testSubscriptGetModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
28522871
// CHECK: [[BOX:%.*]] = alloc_box $
2853-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2872+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2873+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
28542874
//
28552875
// The first get call
28562876
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
@@ -2900,7 +2920,8 @@ public func testSubscriptGetModifyThroughNonCopyableParentStruct_BaseLoadable_Re
29002920

29012921
// CHECK-LABEL: sil [ossa] @$s8moveonly87testSubscriptGetModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
29022922
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
2903-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
2923+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
2924+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
29042925
//
29052926
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
29062927
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]

test/SILGen/moveonly_deinits.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ var value: Bool { false }
8282

8383
// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits24testIntPairWithoutDeinityyF : $@convention(thin) () -> () {
8484
// SILGEN: [[BOX:%.*]] = alloc_box
85-
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
85+
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
86+
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
8687
// SILGEN: cond_br {{%.*}}, bb1, bb2
8788
//
8889
// SILGEN: bb1:
@@ -131,7 +132,8 @@ public func testIntPairWithoutDeinit() {
131132

132133
// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits21testIntPairWithDeinityyF : $@convention(thin) () -> () {
133134
// SILGEN: [[BOX:%.*]] = alloc_box
134-
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
135+
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
136+
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
135137
// SILGEN: cond_br {{%.*}}, bb1, bb2
136138
//
137139
// SILGEN: bb1:
@@ -342,7 +344,8 @@ func consumeKlassEnumPairWithDeinit(_ x: __owned KlassEnumPairWithDeinit) { }
342344

343345
// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits28testIntEnumPairWithoutDeinityyF : $@convention(thin) () -> () {
344346
// SILGEN: [[BOX:%.*]] = alloc_box
345-
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
347+
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
348+
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
346349
// SILGEN: cond_br {{%.*}}, bb1, bb2
347350
//
348351
// SILGEN: bb1:
@@ -390,7 +393,8 @@ public func testIntEnumPairWithoutDeinit() {
390393

391394
// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits25testIntEnumPairWithDeinityyF : $@convention(thin) () -> () {
392395
// SILGEN: [[BOX:%.*]] = alloc_box
393-
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
396+
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
397+
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
394398
// SILGEN: cond_br {{%.*}}, bb1, bb2
395399
//
396400
// SILGEN: bb1:

test/SILGen/moveonly_enum_literal.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ var value: Bool { false }
1515

1616
// CHECK-LABEL: sil hidden [ossa] @$s21moveonly_enum_literal4testyyF : $@convention(thin) () -> () {
1717
// CHECK: [[BOX:%.*]] = alloc_box
18-
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
18+
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
19+
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
1920
// CHECK: [[VALUE:%.*]] = enum $MoveOnlyIntPair, #MoveOnlyIntPair.lhs!enumelt,
2021
// CHECK: store [[VALUE]] to [init] [[PROJECT]]
2122
//

0 commit comments

Comments
 (0)