Skip to content

Commit ff42388

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents a6ab235 + d97e767 commit ff42388

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2844,7 +2844,7 @@ void IRGenModule::createReplaceableProlog(IRGenFunction &IGF, SILFunction *f) {
28442844
unsigned argIdx = 0;
28452845
for (auto arg : forwardedArgs) {
28462846
// Replace the context argument.
2847-
if (argIdx == asyncContextIndex)
2847+
if (argIdx == asyncFnPtr.getSignature().getAsyncContextIndex())
28482848
arguments.push_back(Builder.CreateBitOrPointerCast(
28492849
calleeContextBuffer.getAddress(), IGM.SwiftContextPtrTy));
28502850
else

test/IRGen/async_dynamic_replacement.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ internal func _replacement_number() async -> Int {
2323
public func calls_number() async -> Int {
2424
await number()
2525
}
26+
27+
// CHECK-LABEL: define {{.*}}swifttailcc void @"$s25async_dynamic_replacement32indirectReturnDynamicReplaceableSi_S6ityYaKF"(<{ %TSi, %TSi, %TSi, %TSi, %TSi, %TSi, %TSi }>* {{.*}}%0, %swift.context* swiftasync %1)
28+
// CHECK: forward_to_replaced:
29+
// CHECK: musttail call swifttailcc void {{.*}}(<{ %TSi, %TSi, %TSi, %TSi, %TSi, %TSi, %TSi }>* noalias nocapture %0, %swift.context* swiftasync {{.*}})
30+
public dynamic func indirectReturnDynamicReplaceable() async throws -> (Int, Int, Int, Int, Int, Int, Int) {
31+
return (0, 0, 0, 0, 0, 0, 0)
32+
}

0 commit comments

Comments
 (0)