Skip to content

Commit 57dd8f5

Browse files
committed
Merge remote-tracking branch 'origin/main' into next
2 parents c17aa76 + 13cdc66 commit 57dd8f5

File tree

11 files changed

+183
-88
lines changed

11 files changed

+183
-88
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 2 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)

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,9 @@ static void addLowLevelPassPipeline(SILPassPipelinePlan &P) {
760760
P.addObjectOutliner();
761761
P.addDeadStoreElimination();
762762

763+
// dead-store-elimination can expose opportunities for dead object elimination.
764+
P.addDeadObjectElimination();
765+
763766
// We've done a lot of optimizations on this function, attempt to FSO.
764767
P.addFunctionSignatureOpts();
765768
P.addComputeEscapeEffects();

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
//===----------------------------------------------------------------------===//
@@ -899,6 +913,7 @@ void UnitTestRunner::withTest(StringRef name, Doit doit) {
899913
ADD_UNIT_TEST_SUBCLASS("find-enclosing-defs", FindEnclosingDefsTest)
900914
ADD_UNIT_TEST_SUBCLASS("function-get-self-argument-index", FunctionGetSelfArgumentIndex)
901915
ADD_UNIT_TEST_SUBCLASS("has-pointer-escape", OwnershipUtilsHasPointerEscape)
916+
ADD_UNIT_TEST_SUBCLASS("print-type-lowering", PrintTypeLowering)
902917
ADD_UNIT_TEST_SUBCLASS("interior-liveness", InteriorLivenessTest)
903918
ADD_UNIT_TEST_SUBCLASS("is-deinit-barrier", IsDeinitBarrierTest)
904919
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
@@ -89,7 +89,8 @@ func invokedDeinit() {}
8989
// CHECK-LABEL: sil hidden [ossa] @$s4test11PointerTreeV10tryDestroy9doDiscardySb_tKF : $@convention(method) (Bool, @owned PointerTree) -> @error any Error {
9090
// CHECK: bb0{{.*}}:
9191
// CHECK: [[SELF_BOX:%.*]] = alloc_box ${ var PointerTree }, var, name "self"
92-
// CHECK: [[SELF_PTR:%.*]] = project_box [[SELF_BOX]] : ${ var PointerTree }, 0
92+
// CHECK: [[SELF_BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[SELF_BOX]]
93+
// CHECK: [[SELF_PTR:%.*]] = project_box [[SELF_BOX_LIFETIME]] : ${ var PointerTree }, 0
9394
// .. skip to the conditional test ..
9495
// CHECK: [[SHOULD_FORGET:%.*]] = struct_extract {{.*}} : $Bool, #Bool._value
9596
// CHECK: cond_br [[SHOULD_FORGET]], bb1, bb2
@@ -107,6 +108,7 @@ func invokedDeinit() {}
107108
// CHECK: br bb3
108109
//
109110
// CHECK: bb3:
111+
// CHECK: end_borrow [[SELF_BOX_LIFETIME]]
110112
// CHECK: destroy_value [[SELF_BOX]] : ${ var PointerTree }
111113
// CHECK: throw
112114
// 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
@@ -83,7 +83,8 @@ var value: Bool { false }
8383

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

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

344346
// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits28testIntEnumPairWithoutDeinityyF : $@convention(thin) () -> () {
345347
// SILGEN: [[BOX:%.*]] = alloc_box
346-
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
348+
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
349+
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
347350
// SILGEN: cond_br {{%.*}}, bb1, bb2
348351
//
349352
// SILGEN: bb1:
@@ -391,7 +394,8 @@ public func testIntEnumPairWithoutDeinit() {
391394

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

test/SILGen/moveonly_enum_literal.swift

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

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

0 commit comments

Comments
 (0)