|
27 | 27 | #include "llvm/IR/Dominators.h"
|
28 | 28 | #include "llvm/IR/IRBuilder.h"
|
29 | 29 | #include "llvm/IR/InstIterator.h"
|
| 30 | +#include "llvm/IR/IntrinsicInst.h" |
30 | 31 | #include "llvm/Support/CommandLine.h"
|
31 | 32 | #include "llvm/Support/Debug.h"
|
32 | 33 | #include "llvm/Support/MathExtras.h"
|
@@ -1662,6 +1663,12 @@ static Instruction *insertSpills(const FrameDataInfo &FrameData,
|
1662 | 1663 | }
|
1663 | 1664 | }
|
1664 | 1665 |
|
| 1666 | + // Salvage debug info on any dbg.addr that we see. We do not insert them |
| 1667 | + // into each block where we have a use though. |
| 1668 | + if (auto *DI = dyn_cast<DbgAddrIntrinsic>(U)) { |
| 1669 | + coro::salvageDebugInfo(DbgPtrAllocaCache, DI, Shape.OptimizeFrame); |
| 1670 | + } |
| 1671 | + |
1665 | 1672 | // If we have a single edge PHINode, remove it and replace it with a
|
1666 | 1673 | // reload from the coroutine frame. (We already took care of multi edge
|
1667 | 1674 | // PHINodes by rewriting them in the rewritePHIs function).
|
@@ -2579,8 +2586,10 @@ void coro::salvageDebugInfo(
|
2579 | 2586 |
|
2580 | 2587 | DVI->replaceVariableLocationOp(OriginalStorage, Storage);
|
2581 | 2588 | DVI->setExpression(Expr);
|
2582 |
| - /// It makes no sense to move the dbg.value intrinsic. |
2583 |
| - if (!isa<DbgValueInst>(DVI)) { |
| 2589 | + // We only hoist dbg.declare today since it doesn't make sense to hoist |
| 2590 | + // dbg.value or dbg.addr since they do not have the same function wide |
| 2591 | + // guarantees that dbg.declare does. |
| 2592 | + if (!isa<DbgValueInst>(DVI) && !isa<DbgAddrIntrinsic>(DVI)) { |
2584 | 2593 | if (auto *II = dyn_cast<InvokeInst>(Storage))
|
2585 | 2594 | DVI->moveBefore(II->getNormalDest()->getFirstNonPHI());
|
2586 | 2595 | else if (auto *CBI = dyn_cast<CallBrInst>(Storage))
|
|
0 commit comments