Skip to content

Commit cf9ed6e

Browse files
committed
Disable swift function merging for swift async functions
It breaks withCheckedContinuation. I have not gotten to the bottom of why. But for now disable the pass for all async functions until we can fix it. rdar://77166575
1 parent dfec9e6 commit cf9ed6e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/LLVMPasses/LLVMMergeFunctions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,9 @@ static bool isEligibleFunction(Function *F) {
664664

665665
if (F->getFunctionType()->isVarArg())
666666
return false;
667+
668+
if (F->getCallingConv() == CallingConv::SwiftTail)
669+
return false;
667670

668671
unsigned Benefit = getBenefit(F);
669672
if (Benefit < FunctionMergeThreshold)

test/Concurrency/Runtime/checked_continuation.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,30 @@ struct TestError: Error {}
4141
}
4242
await task.get()
4343
}
44+
45+
tests.test("test withCheckedThrowingContinuation") {
46+
let task2 = detach {
47+
do {
48+
let x: Int = try await withCheckedThrowingContinuation { c in
49+
c.resume(returning: 17)
50+
}
51+
expectEqual(17, x)
52+
} catch {
53+
}
54+
}
55+
56+
let task = detach {
57+
do {
58+
let x: Int = try await withCheckedThrowingContinuation { c in
59+
c.resume(returning: 17)
60+
}
61+
expectEqual(17, x)
62+
} catch {
63+
}
64+
}
65+
await task.get()
66+
await task2.get()
67+
}
4468
}
4569

4670
await runAllTestsAsync()

0 commit comments

Comments
 (0)