Skip to content

[TypeLowering] Move-only types are lexical. #66705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/SIL/IR/TypeLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2394,6 +2394,7 @@ namespace {

if (D->isMoveOnly()) {
properties.setNonTrivial();
properties.setLexical(IsLexical);
if (properties.isAddressOnly())
return handleMoveOnlyAddressOnly(structType, properties);
return new (TC) MoveOnlyLoadableStructTypeLowering(
Expand Down Expand Up @@ -2475,6 +2476,7 @@ namespace {

if (D->isMoveOnly()) {
properties.setNonTrivial();
properties.setLexical(IsLexical);
if (properties.isAddressOnly())
return handleMoveOnlyAddressOnly(enumType, properties);
return new (TC)
Expand Down
15 changes: 15 additions & 0 deletions lib/SILOptimizer/UtilityPasses/UnitTestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#include "swift/SILOptimizer/Utils/InstructionDeleter.h"
#include "swift/SILOptimizer/Utils/ParseTestSpecification.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <iterator>
#include <memory>
Expand Down Expand Up @@ -287,6 +288,19 @@ struct OwnershipUtilsHasPointerEscape : UnitTest {
}
};

// Arguments:
// - value: whose type will be printed
// Dumps:
// - the type lowering of the type
struct PrintTypeLowering : UnitTest {
PrintTypeLowering(UnitTestRunner *pass) : UnitTest(pass) {}
void invoke(Arguments &arguments) override {
auto value = arguments.takeValue();
auto ty = value->getType();
getFunction()->getTypeLowering(ty).print(llvm::dbgs());
}
};

//===----------------------------------------------------------------------===//
// MARK: OSSA Lifetime Unit Tests
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -899,6 +913,7 @@ void UnitTestRunner::withTest(StringRef name, Doit doit) {
ADD_UNIT_TEST_SUBCLASS("find-enclosing-defs", FindEnclosingDefsTest)
ADD_UNIT_TEST_SUBCLASS("function-get-self-argument-index", FunctionGetSelfArgumentIndex)
ADD_UNIT_TEST_SUBCLASS("has-pointer-escape", OwnershipUtilsHasPointerEscape)
ADD_UNIT_TEST_SUBCLASS("print-type-lowering", PrintTypeLowering)
ADD_UNIT_TEST_SUBCLASS("interior-liveness", InteriorLivenessTest)
ADD_UNIT_TEST_SUBCLASS("is-deinit-barrier", IsDeinitBarrierTest)
ADD_UNIT_TEST_SUBCLASS("is-lexical", IsLexicalTest)
Expand Down
18 changes: 18 additions & 0 deletions test/SIL/type_lowering_unit.sil
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: %target-sil-opt -unit-test-runner %s -o /dev/null 2>&1 | %FileCheck %s

sil_stage raw

import Builtin

struct S : ~Copyable {}

// CHECK-LABEL: begin {{.*}} print-type-lowering with: @argument[0]
// CHECK: isLexical: true
// CHECK-LABEL: end {{.*}} print-type-lowering with: @argument[0]
sil [ossa] @move_only_argument : $@convention(thin) (@owned S) -> () {
bb0(%0 : @owned $S):
test_specification "print-type-lowering @argument[0]"
destroy_value %0 : $S
%retval = tuple ()
return %retval : $()
}
4 changes: 3 additions & 1 deletion test/SILGen/discard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func invokedDeinit() {}
// CHECK-LABEL: sil hidden [ossa] @$s4test11PointerTreeV10tryDestroy9doDiscardySb_tKF : $@convention(method) (Bool, @owned PointerTree) -> @error any Error {
// CHECK: bb0{{.*}}:
// CHECK: [[SELF_BOX:%.*]] = alloc_box ${ var PointerTree }, var, name "self"
// CHECK: [[SELF_PTR:%.*]] = project_box [[SELF_BOX]] : ${ var PointerTree }, 0
// CHECK: [[SELF_BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[SELF_BOX]]
// CHECK: [[SELF_PTR:%.*]] = project_box [[SELF_BOX_LIFETIME]] : ${ var PointerTree }, 0
// .. skip to the conditional test ..
// CHECK: [[SHOULD_FORGET:%.*]] = struct_extract {{.*}} : $Bool, #Bool._value
// CHECK: cond_br [[SHOULD_FORGET]], bb1, bb2
Expand All @@ -107,6 +108,7 @@ func invokedDeinit() {}
// CHECK: br bb3
//
// CHECK: bb3:
// CHECK: end_borrow [[SELF_BOX_LIFETIME]]
// CHECK: destroy_value [[SELF_BOX]] : ${ var PointerTree }
// CHECK: throw
// CHECK: } // end sil function
Expand Down
63 changes: 42 additions & 21 deletions test/SILGen/moveonly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,8 @@ struct EmptyStruct {
// CHECK-LABEL: sil hidden [ossa] @$s8moveonly11EmptyStructVACycfC : $@convention(method) (@thin EmptyStruct.Type) -> @owned EmptyStruct {
// CHECK: [[BOX:%.*]] = alloc_box ${ var EmptyStruct }, var, name "self"
// CHECK: [[MARKED_UNINIT:%.*]] = mark_uninitialized [rootself] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[MARKED_UNINIT]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[MARKED_UNINIT]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
// CHECK: [[STRUCT:%.*]] = struct $EmptyStruct ()
// CHECK: store [[STRUCT]] to [init] [[PROJECT]]
// CHECK: [[MV_CHECK:%.*]] = mark_must_check [assignable_but_not_consumable] [[PROJECT]]
Expand Down Expand Up @@ -1039,7 +1040,8 @@ public struct LoadableSubscriptGetOnlyTester : ~Copyable {

// CHECK-LABEL: sil [ossa] @$s8moveonly047testSubscriptGetOnly_BaseLoadable_ResultAddressE4_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -1077,7 +1079,8 @@ public func testSubscriptGetOnly_BaseLoadable_ResultAddressOnly_Var() {

// CHECK-LABEL: sil [ossa] @$s8moveonly047testSubscriptGetOnly_BaseLoadable_ResultAddressE4_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
Expand Down Expand Up @@ -1140,7 +1143,8 @@ public struct LoadableSubscriptGetOnlyTesterNonCopyableStructParent : ~Copyable

// CHECK-LABEL: sil [ossa] @$s8moveonly077testSubscriptGetOnlyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressE4_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The first get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -1181,7 +1185,8 @@ public func testSubscriptGetOnlyThroughNonCopyableParentStruct_BaseLoadable_Resu

// CHECK-LABEL: sil [ossa] @$s8moveonly077testSubscriptGetOnlyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressE4_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
Expand Down Expand Up @@ -1350,7 +1355,8 @@ public struct LoadableSubscriptGetSetTester : ~Copyable {

// CHECK-LABEL: sil [ossa] @$s8moveonly54testSubscriptGetSet_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -1396,7 +1402,8 @@ public func testSubscriptGetSet_BaseLoadable_ResultAddressOnly_Var() {

// CHECK-LABEL: sil [ossa] @$s8moveonly54testSubscriptGetSet_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
Expand Down Expand Up @@ -1507,7 +1514,8 @@ public struct LoadableSubscriptGetSetTesterNonCopyableStructParent : ~Copyable {

// CHECK-LABEL: sil [ossa] @$s8moveonly84testSubscriptGetSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The first get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -1561,7 +1569,8 @@ public func testSubscriptGetSetThroughNonCopyableParentStruct_BaseLoadable_Resul

// CHECK-LABEL: sil [ossa] @$s8moveonly84testSubscriptGetSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
Expand Down Expand Up @@ -1819,7 +1828,8 @@ public struct LoadableSubscriptReadSetTester : ~Copyable {

// CHECK-LABEL: sil [ossa] @$s8moveonly55testSubscriptReadSet_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The read call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -1865,7 +1875,8 @@ public func testSubscriptReadSet_BaseLoadable_ResultAddressOnly_Var() {

// CHECK-LABEL: sil [ossa] @$s8moveonly55testSubscriptReadSet_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
Expand Down Expand Up @@ -1979,7 +1990,8 @@ public struct LoadableSubscriptReadSetTesterNonCopyableStructParent : ~Copyable

// CHECK-LABEL: sil [ossa] @$s8moveonly85testSubscriptReadSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The first get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -2031,7 +2043,8 @@ public func testSubscriptReadSetThroughNonCopyableParentStruct_BaseLoadable_Resu

// CHECK-LABEL: sil [ossa] @$s8moveonly85testSubscriptReadSetThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
Expand Down Expand Up @@ -2285,7 +2298,8 @@ public struct LoadableSubscriptReadModifyTester : ~Copyable {

// CHECK-LABEL: sil [ossa] @$s8moveonly58testSubscriptReadModify_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The read call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -2328,7 +2342,8 @@ public func testSubscriptReadModify_BaseLoadable_ResultAddressOnly_Var() {

// CHECK-LABEL: sil [ossa] @$s8moveonly58testSubscriptReadModify_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
Expand Down Expand Up @@ -2431,7 +2446,8 @@ public struct LoadableSubscriptReadModifyTesterNonCopyableStructParent : ~Copyab

// CHECK-LABEL: sil [ossa] @$s8moveonly88testSubscriptReadModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The first get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -2477,7 +2493,8 @@ public func testSubscriptReadModifyThroughNonCopyableParentStruct_BaseLoadable_R

// CHECK-LABEL: sil [ossa] @$s8moveonly88testSubscriptReadModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
Expand Down Expand Up @@ -2699,7 +2716,8 @@ public struct LoadableSubscriptGetModifyTester : ~Copyable {

// CHECK-LABEL: sil [ossa] @$s8moveonly57testSubscriptGetModify_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -2743,7 +2761,8 @@ public func testSubscriptGetModify_BaseLoadable_ResultAddressOnly_Var() {

// CHECK-LABEL: sil [ossa] @$s8moveonly57testSubscriptGetModify_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The get call
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
Expand Down Expand Up @@ -2850,7 +2869,8 @@ public struct LoadableSubscriptGetModifyTesterNonCopyableStructParent : ~Copyabl

// CHECK-LABEL: sil [ossa] @$s8moveonly87testSubscriptGetModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_VaryyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box $
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// The first get call
// CHECK: [[ACCESS:%.*]] = begin_access [read] [unknown] [[PROJECT]]
Expand Down Expand Up @@ -2900,7 +2920,8 @@ public func testSubscriptGetModifyThroughNonCopyableParentStruct_BaseLoadable_Re

// CHECK-LABEL: sil [ossa] @$s8moveonly87testSubscriptGetModifyThroughNonCopyableParentStruct_BaseLoadable_ResultAddressOnly_LetyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box ${ let L
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
//
// CHECK: [[MARK:%.*]] = mark_must_check [no_consume_or_assign] [[PROJECT]]
// CHECK: [[LOAD:%.*]] = load_borrow [[MARK]]
Expand Down
12 changes: 8 additions & 4 deletions test/SILGen/moveonly_deinits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ var value: Bool { false }

// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits24testIntPairWithoutDeinityyF : $@convention(thin) () -> () {
// SILGEN: [[BOX:%.*]] = alloc_box
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
// SILGEN: cond_br {{%.*}}, bb1, bb2
//
// SILGEN: bb1:
Expand Down Expand Up @@ -132,7 +133,8 @@ public func testIntPairWithoutDeinit() {

// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits21testIntPairWithDeinityyF : $@convention(thin) () -> () {
// SILGEN: [[BOX:%.*]] = alloc_box
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
// SILGEN: cond_br {{%.*}}, bb1, bb2
//
// SILGEN: bb1:
Expand Down Expand Up @@ -343,7 +345,8 @@ func consumeKlassEnumPairWithDeinit(_ x: __owned KlassEnumPairWithDeinit) { }

// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits28testIntEnumPairWithoutDeinityyF : $@convention(thin) () -> () {
// SILGEN: [[BOX:%.*]] = alloc_box
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
// SILGEN: cond_br {{%.*}}, bb1, bb2
//
// SILGEN: bb1:
Expand Down Expand Up @@ -391,7 +394,8 @@ public func testIntEnumPairWithoutDeinit() {

// SILGEN-LABEL: sil [ossa] @$s16moveonly_deinits25testIntEnumPairWithDeinityyF : $@convention(thin) () -> () {
// SILGEN: [[BOX:%.*]] = alloc_box
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX]]
// SILGEN: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// SILGEN: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
// SILGEN: cond_br {{%.*}}, bb1, bb2
//
// SILGEN: bb1:
Expand Down
3 changes: 2 additions & 1 deletion test/SILGen/moveonly_enum_literal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var value: Bool { false }

// CHECK-LABEL: sil hidden [ossa] @$s21moveonly_enum_literal4testyyF : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box
// CHECK: [[PROJECT:%.*]] = project_box [[BOX]]
// CHECK: [[BOX_LIFETIME:%.*]] = begin_borrow [lexical] [[BOX]]
// CHECK: [[PROJECT:%.*]] = project_box [[BOX_LIFETIME]]
// CHECK: [[VALUE:%.*]] = enum $MoveOnlyIntPair, #MoveOnlyIntPair.lhs!enumelt,
// CHECK: store [[VALUE]] to [init] [[PROJECT]]
//
Expand Down
Loading