[PATCH] D102412: [coro] Preserve scope line for compiler generated functions
Dave Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 2 15:57:36 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60ce8babf77e: [coro] Preserve scope line for compiler generated functions (authored by kastiglione).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102412/new/
https://reviews.llvm.org/D102412
Files:
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-async.ll
Index: llvm/test/Transforms/Coroutines/coro-async.ll
===================================================================
--- llvm/test/Transforms/Coroutines/coro-async.ll
+++ llvm/test/Transforms/Coroutines/coro-async.ll
@@ -187,7 +187,7 @@
i32 128 ; Initial async context size without space for frame
}>
-define swiftcc void @my_async_function2(%async.task* %task, %async.actor* %actor, i8* %async.ctxt) "frame-pointer"="all" {
+define swiftcc void @my_async_function2(%async.task* %task, %async.actor* %actor, i8* %async.ctxt) "frame-pointer"="all" !dbg !6 {
entry:
%id = call token @llvm.coro.id.async(i32 128, i32 16, i32 2, i8* bitcast (<{i32, i32}>* @my_async_function2_fp to i8*))
@@ -210,7 +210,7 @@
i8* %resume.func_ptr,
i8* %resume_proj_fun,
void (i8*, i8*, %async.task*, %async.actor*)* @my_async_function.my_other_async_function_fp.apply,
- i8* %callee, i8* %callee_context, %async.task* %task, %async.actor *%actor)
+ i8* %callee, i8* %callee_context, %async.task* %task, %async.actor *%actor), !dbg !9
%continuation_task_arg = extractvalue {i8*, i8*, i8*} %res, 0
%task.2 = bitcast i8* %continuation_task_arg to %async.task*
@@ -241,6 +241,7 @@
; CHECK-LABEL: define swiftcc void @my_async_function2(%async.task* %task, %async.actor* %actor, i8* %async.ctxt)
; CHECK-SAME: #[[FRAMEPOINTER:[0-9]+]]
+; CHECK-SAME: !dbg ![[SP3:[0-9]+]]
; CHECK: store i8* %async.ctxt,
; CHECK: store %async.actor* %actor,
; CHECK: store %async.task* %task,
@@ -253,6 +254,7 @@
; CHECK-LABEL: define internal swiftcc void @my_async_function2.resume.0(i8* %0, i8* nocapture readnone %1, i8* nocapture readonly %2)
; CHECK-SAME: #[[FRAMEPOINTER]]
+; CHECK-SAME: !dbg ![[SP4:[0-9]+]]
; CHECK: [[CALLEE_CTXT_ADDR:%.*]] = bitcast i8* %2 to i8**
; CHECK: [[CALLEE_CTXT:%.*]] = load i8*, i8** [[CALLEE_CTXT_ADDR]]
; CHECK: [[CALLEE_CTXT_SPILL_ADDR:%.*]] = getelementptr inbounds i8, i8* [[CALLEE_CTXT]], i64 152
@@ -554,3 +556,16 @@
!4 = !DISubroutineType(types: !{})
!5 = !DILocation(line: 2, column: 0, scope: !1)
+; CHECK: ![[SP3]] = distinct !DISubprogram(name: "my_async_function2",
+; CHECK-SAME: linkageName: "my_async_function2",
+; CHECK-SAME: scopeLine: 1
+!6 = distinct !DISubprogram(name: "my_async_function2",
+ linkageName: "my_async_function2",
+ scope: !2, file: !3, line: 1, type: !4,
+ scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2)
+; CHECK: ![[SP4]] = distinct !DISubprogram(name: "my_async_function2",
+; CHECK-SAME: linkageName: "my_async_function2.resume.0",
+; CHECK-SAME: scopeLine: 1
+!7 = !DILexicalBlockFile(scope: !6, file: !8, discriminator: 0)
+!8 = !DIFile(filename: "/tmp/fake.cpp", directory: "/")
+!9 = !DILocation(line: 2, column: 0, scope: !7)
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -862,14 +862,17 @@
auto &Context = NewF->getContext();
// For async functions / continuations, adjust the scope line of the
- // clone to the line number of the suspend point. The scope line is
+ // clone to the line number of the suspend point. However, only
+ // adjust the scope line when the files are the same. This ensures
+ // line number and file name belong together. The scope line is
// associated with all pre-prologue instructions. This avoids a jump
// in the linetable from the function declaration to the suspend point.
if (DISubprogram *SP = NewF->getSubprogram()) {
assert(SP != OrigF.getSubprogram() && SP->isDistinct());
if (ActiveSuspend)
if (auto DL = ActiveSuspend->getDebugLoc())
- SP->setScopeLine(DL->getLine());
+ if (SP->getFile() == DL->getFile())
+ SP->setScopeLine(DL->getLine());
// Update the linkage name to reflect the modified symbol name. It
// is necessary to update the linkage name in Swift, since the
// mangling changes for resume functions. It might also be the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102412.349408.patch
Type: text/x-patch
Size: 4471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210602/4168cda9/attachment.bin>
More information about the llvm-commits
mailing list