[llvm] [coroutines] Use DILocation from new storage for hoisted dbg.declare (PR #75402)

Chuanqi Xu via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 18:45:27 PST 2023


================
@@ -2951,9 +2951,11 @@ void coro::salvageDebugInfo(
   // dbg.declare does.
   if (isa<DbgDeclareInst>(DVI)) {
     std::optional<BasicBlock::iterator> InsertPt;
-    if (auto *I = dyn_cast<Instruction>(Storage))
+    if (auto *I = dyn_cast<Instruction>(Storage)) {
       InsertPt = I->getInsertionPointAfterDef();
-    else if (isa<Argument>(Storage))
+      if (!OptimizeFrame && I->getDebugLoc())
----------------
ChuanqiXu9 wrote:

```suggestion
      // Don't hoist debug intrinsics since it is easy to get out of sync in optimizations.
      // See  https://github.com/llvm/llvm-project/pull/75104 for an example.
      if (!OptimizeFrame && I->getDebugLoc())
```

nit

https://github.com/llvm/llvm-project/pull/75402


More information about the llvm-commits mailing list