Skip to content

Commit 45ec725

Browse files
Merge pull request swiftlang#42485 from nate-chandler/rdar85526916
[SILGen] Use opaque AP for ObjC-async returns.
2 parents 38c0de0 + 4aff98f commit 45ec725

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

lib/SIL/IR/SILInstructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2839,7 +2839,7 @@ SILType GetAsyncContinuationInstBase::getLoweredResumeType() const {
28392839
auto formalType = getFormalResumeType();
28402840
auto &M = getFunction()->getModule();
28412841
auto c = getFunction()->getTypeExpansionContext();
2842-
return M.Types.getLoweredType(AbstractionPattern(formalType), formalType, c);
2842+
return M.Types.getLoweredType(AbstractionPattern::getOpaque(), formalType, c);
28432843
}
28442844

28452845
ReturnInst::ReturnInst(SILFunction &func, SILDebugLocation debugLoc,

lib/SILGen/ResultPlan.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,8 @@ class ForeignAsyncInitializationPlan final : public ResultPlan {
506506
{
507507
// Allocate space to receive the resume value when the continuation is
508508
// resumed.
509-
opaqueResumeType =
510-
SGF.getLoweredType(AbstractionPattern(calleeTypeInfo.substResultType),
511-
calleeTypeInfo.substResultType);
509+
opaqueResumeType = SGF.getLoweredType(AbstractionPattern::getOpaque(),
510+
calleeTypeInfo.substResultType);
512511
resumeBuf = SGF.emitTemporaryAllocation(loc, opaqueResumeType);
513512
}
514513

@@ -707,14 +706,12 @@ class ForeignAsyncInitializationPlan final : public ResultPlan {
707706
// The incoming value is the maximally-abstracted result type of the
708707
// continuation. Move it out of the resume buffer and reabstract it if
709708
// necessary.
710-
auto resumeResult = SGF.emitLoad(loc, resumeBuf,
711-
calleeTypeInfo.origResultType
712-
? *calleeTypeInfo.origResultType
713-
: AbstractionPattern(calleeTypeInfo.substResultType),
714-
calleeTypeInfo.substResultType,
715-
SGF.getTypeLowering(calleeTypeInfo.substResultType),
716-
SGFContext(), IsTake);
717-
709+
auto resumeResult =
710+
SGF.emitLoad(loc, resumeBuf, AbstractionPattern::getOpaque(),
711+
calleeTypeInfo.substResultType,
712+
SGF.getTypeLowering(calleeTypeInfo.substResultType),
713+
SGFContext(), IsTake);
714+
718715
return RValue(SGF, loc, calleeTypeInfo.substResultType, resumeResult);
719716
}
720717
};

validation-test/compiler_crashers_2_fixed/rdar79383990.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-swift-frontend %s -emit-silgen -disable-availability-checking -import-objc-header %S/Inputs/rdar79383990.h
22
// REQUIRES: objc_interop
3-
// REQUIRES: OS=macosx
43

54
import Foundation
65

validation-test/compiler_crashers_2_fixed/rdar81590807.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
// REQUIRES: executable_test
1414
// REQUIRES: OS=macosx || OS=ios
15-
// Enable with rdar://85526879
16-
// UNSUPPORTED: CPU=arm64e
1715

1816
// rdar://82123254
1917
// UNSUPPORTED: use_os_stdlib

validation-test/compiler_crashers_2_fixed/rdar81617749.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
// Enable with rdar://81617749
1111
// UNSUPPORTED: CPU=i386 && OS=watchos
12-
// Enable with rdar://85526916
13-
// UNSUPPORTED: CPU=arm64e
1412

1513
// rdar://82123254
1614
// UNSUPPORTED: use_os_stdlib

0 commit comments

Comments
 (0)