|
25 | 25 | #include "llvm/IR/Dominators.h"
|
26 | 26 | #include "llvm/IR/IRBuilder.h"
|
27 | 27 | #include "llvm/IR/InstIterator.h"
|
| 28 | +#include "llvm/IR/IntrinsicInst.h" |
28 | 29 | #include "llvm/Support/CommandLine.h"
|
29 | 30 | #include "llvm/Support/Debug.h"
|
30 | 31 | #include "llvm/Support/MathExtras.h"
|
@@ -1667,6 +1668,12 @@ static Instruction *insertSpills(const FrameDataInfo &FrameData,
|
1667 | 1668 | }
|
1668 | 1669 | }
|
1669 | 1670 |
|
| 1671 | + // Salvage debug info on any dbg.addr that we see. We do not insert them |
| 1672 | + // into each block where we have a use though. |
| 1673 | + if (auto *DI = dyn_cast<DbgAddrIntrinsic>(U)) { |
| 1674 | + coro::salvageDebugInfo(DbgPtrAllocaCache, DI, Shape.ReuseFrameSlot); |
| 1675 | + } |
| 1676 | + |
1670 | 1677 | // If we have a single edge PHINode, remove it and replace it with a
|
1671 | 1678 | // reload from the coroutine frame. (We already took care of multi edge
|
1672 | 1679 | // PHINodes by rewriting them in the rewritePHIs function).
|
@@ -2599,8 +2606,11 @@ void coro::salvageDebugInfo(
|
2599 | 2606 | }
|
2600 | 2607 | DVI->replaceVariableLocationOp(OriginalStorage, Storage);
|
2601 | 2608 | DVI->setExpression(Expr);
|
2602 |
| - /// It makes no sense to move the dbg.value intrinsic. |
2603 |
| - if (!isa<DbgValueInst>(DVI)) { |
| 2609 | + |
| 2610 | + // We only hoist dbg.declare today since it doesn't make sense to hoist |
| 2611 | + // dbg.value or dbg.addr since they do not have the same function wide |
| 2612 | + // guarantees that dbg.declare does. |
| 2613 | + if (!isa<DbgValueInst>(DVI) && !isa<DbgAddrIntrinsic>(DVI)) { |
2604 | 2614 | if (auto *InsertPt = dyn_cast<Instruction>(Storage))
|
2605 | 2615 | DVI->moveAfter(InsertPt);
|
2606 | 2616 | else if (isa<Argument>(Storage))
|
|
0 commit comments