Skip to content

Commit 36f818b

Browse files
authored
Merge pull request #8143 from apple/revert-7797-coro-retcon-once-return
Revert "Cherry-pick 51d5d7b from LLVM mainline"
2 parents 63249ca + f3dee1c commit 36f818b

File tree

128 files changed

+495
-917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+495
-917
lines changed

clang/lib/CodeGen/CGCoroutine.cpp

+4-13
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,8 @@ struct CallCoroEnd final : public EHScopeStack::Cleanup {
402402
llvm::Function *CoroEndFn = CGM.getIntrinsic(llvm::Intrinsic::coro_end);
403403
// See if we have a funclet bundle to associate coro.end with. (WinEH)
404404
auto Bundles = getBundlesForCoroEnd(CGF);
405-
auto *CoroEnd =
406-
CGF.Builder.CreateCall(CoroEndFn,
407-
{NullPtr, CGF.Builder.getTrue(),
408-
llvm::ConstantTokenNone::get(CoroEndFn->getContext())},
409-
Bundles);
405+
auto *CoroEnd = CGF.Builder.CreateCall(
406+
CoroEndFn, {NullPtr, CGF.Builder.getTrue()}, Bundles);
410407
if (Bundles.empty()) {
411408
// Otherwise, (landingpad model), create a conditional branch that leads
412409
// either to a cleanup block or a block with EH resume instruction.
@@ -757,9 +754,7 @@ void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) {
757754
// Emit coro.end before getReturnStmt (and parameter destructors), since
758755
// resume and destroy parts of the coroutine should not include them.
759756
llvm::Function *CoroEnd = CGM.getIntrinsic(llvm::Intrinsic::coro_end);
760-
Builder.CreateCall(CoroEnd,
761-
{NullPtr, Builder.getFalse(),
762-
llvm::ConstantTokenNone::get(CoroEnd->getContext())});
757+
Builder.CreateCall(CoroEnd, {NullPtr, Builder.getFalse()});
763758

764759
if (Stmt *Ret = S.getReturnStmt()) {
765760
// Since we already emitted the return value above, so we shouldn't
@@ -828,11 +823,7 @@ RValue CodeGenFunction::EmitCoroutineIntrinsic(const CallExpr *E,
828823
}
829824
for (const Expr *Arg : E->arguments())
830825
Args.push_back(EmitScalarExpr(Arg));
831-
// @llvm.coro.end takes a token parameter. Add token 'none' as the last
832-
// argument.
833-
if (IID == llvm::Intrinsic::coro_end)
834-
Args.push_back(llvm::ConstantTokenNone::get(getLLVMContext()));
835-
826+
836827
llvm::Function *F = CGM.getIntrinsic(IID);
837828
llvm::CallInst *Call = Builder.CreateCall(F, Args);
838829

clang/test/CodeGenCoroutines/coro-builtins.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void f(int n) {
3737
// CHECK-NEXT: call ptr @llvm.coro.free(token %[[COROID]], ptr %[[FRAME]])
3838
__builtin_coro_free(__builtin_coro_frame());
3939

40-
// CHECK-NEXT: call i1 @llvm.coro.end(ptr %[[FRAME]], i1 false, token none)
40+
// CHECK-NEXT: call i1 @llvm.coro.end(ptr %[[FRAME]], i1 false)
4141
__builtin_coro_end(__builtin_coro_frame(), 0);
4242

4343
// CHECK-NEXT: call i8 @llvm.coro.suspend(token none, i1 true)

clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ coro_t f() {
6060

6161
// CHECK: [[COROENDBB]]:
6262
// CHECK-NEXT: %[[CLPAD:.+]] = cleanuppad within none
63-
// CHECK-NEXT: call i1 @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %[[CLPAD]]) ]
63+
// CHECK-NEXT: call i1 @llvm.coro.end(ptr null, i1 true) [ "funclet"(token %[[CLPAD]]) ]
6464
// CHECK-NEXT: cleanupret from %[[CLPAD]] unwind label
6565

6666
// CHECK-LPAD: @_Z1fv(
@@ -76,7 +76,7 @@ coro_t f() {
7676
// CHECK-LPAD: to label %{{.+}} unwind label %[[UNWINDBB:.+]]
7777

7878
// CHECK-LPAD: [[UNWINDBB]]:
79-
// CHECK-LPAD: %[[I1RESUME:.+]] = call i1 @llvm.coro.end(ptr null, i1 true, token none)
79+
// CHECK-LPAD: %[[I1RESUME:.+]] = call i1 @llvm.coro.end(ptr null, i1 true)
8080
// CHECK-LPAD: br i1 %[[I1RESUME]], label %[[EHRESUME:.+]], label
8181
// CHECK-LPAD: [[EHRESUME]]:
8282
// CHECK-LPAD-NEXT: %[[exn:.+]] = load ptr, ptr %exn.slot, align 8

0 commit comments

Comments
 (0)