Skip to content

Commit 6ab3a03

Browse files
authored
Merge pull request #85578 from kavon/opaque-values/fixes-4
2 parents 26627d7 + e5f0ac6 commit 6ab3a03

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

lib/SILGen/SILGenProlog.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,31 +1343,14 @@ static void emitCaptureArguments(SILGenFunction &SGF,
13431343
arg = SILValue(fArg);
13441344

13451345
if (isNoImplicitCopy && !arg->getType().isMoveOnly()) {
1346-
// FIXME: this incompatible with -enable-sil-opaque-values
1347-
switch (fnConv.getSILArgumentConvention(argIndex)) {
1348-
case SILArgumentConvention::Indirect_Inout:
1349-
case SILArgumentConvention::Indirect_InoutAliasable:
1350-
case SILArgumentConvention::Indirect_In:
1351-
case SILArgumentConvention::Indirect_In_Guaranteed:
1352-
case SILArgumentConvention::Indirect_In_CXX:
1353-
case SILArgumentConvention::Pack_Inout:
1354-
case SILArgumentConvention::Pack_Owned:
1355-
case SILArgumentConvention::Pack_Guaranteed:
1346+
if (fnConv.isSILIndirect(paramInfo)) {
13561347
arg = SGF.B.createCopyableToMoveOnlyWrapperAddr(VD, arg);
1357-
break;
1358-
1359-
case SILArgumentConvention::Direct_Owned:
1360-
arg = SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(VD, arg);
1361-
break;
1362-
1363-
case SILArgumentConvention::Direct_Guaranteed:
1348+
1349+
} else if (paramInfo.isGuaranteedInCallee()) {
13641350
arg = SGF.B.createGuaranteedCopyableToMoveOnlyWrapperValue(VD, arg);
1365-
break;
1366-
1367-
case SILArgumentConvention::Direct_Unowned:
1368-
case SILArgumentConvention::Indirect_Out:
1369-
case SILArgumentConvention::Pack_Out:
1370-
llvm_unreachable("should be impossible");
1351+
1352+
} else {
1353+
arg = SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(VD, arg);
13711354
}
13721355
}
13731356

test/SILOptimizer/moveonly_copyable_wrapper_capture.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-swift-frontend -emit-sil -verify %s
2+
// RUN: %target-swift-frontend -enable-sil-opaque-values -sil-verify-all -emit-sil -verify %s
23

34
class Class {}
45
//struct Class : ~Copyable {}

0 commit comments

Comments
 (0)