Skip to content

Commit 6dcd90d

Browse files
committed
IRGen: Use the current function name for the swift_suspend_dispatch thunk
This is an incremental improvement of the debug info at a suspend apply site. Before this patch the debug info at the call site would use the `__swift_suspend_dispatch` function name as the current function after coro lowering has inlined the thunk. The proper fix is to rewire the debug info such that the thunk name is never mentioned rather the current function that suspend site sits in is used. Until I have figured out how to do that using the current function name instead of `__swift_suspend_dispatch.5` for the thunk is an incremental improvement in the debug information consumers can observe. rdar://88579737
1 parent 1843d49 commit 6dcd90d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/IRGen/GenFunc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,7 @@ IRGenFunction::createAsyncDispatchFn(const FunctionPointer &fnPtr,
23662366
auto *dispatchFnTy =
23672367
llvm::FunctionType::get(IGM.VoidTy, argTys, false /*vaargs*/);
23682368
llvm::SmallString<40> name;
2369-
llvm::raw_svector_ostream(name)
2370-
<< "__swift_suspend_dispatch_" << argTypes.size();
2369+
llvm::raw_svector_ostream(name) << CurFn->getName() << ".0";
23712370
llvm::Function *dispatch =
23722371
llvm::Function::Create(dispatchFnTy, llvm::Function::InternalLinkage,
23732372
llvm::StringRef(name), &IGM.Module);

test/IRGen/async/get_async_continuation.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bb0:
7272
// CHECK: {{musttail call swifttailcc|tail call swiftcc}} void @swift_continuation_await(%swift.continuation_context* %0)
7373
// CHECK-NEXT: ret void
7474

75-
// CHECK: define {{.*}} void @__swift_suspend_dispatch_1(i8* %0, %swift.context* %1)
75+
// CHECK: define {{.*}} void @async_continuation.0(i8* %0, %swift.context* %1)
7676
// CHECK-NOT: define
7777
// CHECK: tail call swift{{(tail)?}}cc void %{{.*}}(%swift.context* swiftasync %1)
7878
// CHECK-NEXT: ret void

0 commit comments

Comments
 (0)