[PATCH] D102412: [coro] Preserve scope line for compiler generated functions

Dave Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 12:55:43 PDT 2021


kastiglione updated this revision to Diff 345979.
kastiglione added a comment.

Change logic to be based on current scope line, not current filename.


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


Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -849,15 +849,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
-  // associated with all pre-prologue instructions. This avoids a jump
-  // in the linetable from the function declaration to the suspend point.
+  // For async functions / continuations, adjust the scope line of the clone to
+  // the line number of the suspend point. However, only adjust the scope line
+  // for non-compiler generated functions. 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->getScopeLine() != 0)
+          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.345979.patch
Type: text/x-patch
Size: 1463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210517/cb10ea64/attachment.bin>


More information about the llvm-commits mailing list