Skip to content

Commit

Permalink
[DebugInfo] Remove dbg.addr from Coroutines
Browse files Browse the repository at this point in the history
This removes `dbg.addr` support from the Coroutines transform. This effectively
reverts the `dbg.addr`-only portions of 19279ff
and 0b647fc.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

Differential Revision: https://reviews.llvm.org/D144795
  • Loading branch information
jryans committed Mar 2, 2023
1 parent f5b85c0 commit 29a6b7d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 714 deletions.
12 changes: 3 additions & 9 deletions llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Expand Up @@ -1861,12 +1861,6 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
}
}

// Salvage debug info on any dbg.addr that we see. We do not insert them
// into each block where we have a use though.
if (auto *DI = dyn_cast<DbgAddrIntrinsic>(U)) {
coro::salvageDebugInfo(DbgPtrAllocaCache, DI, Shape.OptimizeFrame);
}

// If we have a single edge PHINode, remove it and replace it with a
// reload from the coroutine frame. (We already took care of multi edge
// PHINodes by rewriting them in the rewritePHIs function).
Expand Down Expand Up @@ -2879,9 +2873,9 @@ void coro::salvageDebugInfo(
DVI->replaceVariableLocationOp(OriginalStorage, Storage);
DVI->setExpression(Expr);
// We only hoist dbg.declare today since it doesn't make sense to hoist
// dbg.value or dbg.addr since they do not have the same function wide
// guarantees that dbg.declare does.
if (!isa<DbgValueInst>(DVI) && !isa<DbgAddrIntrinsic>(DVI)) {
// dbg.value since it does not have the same function wide guarantees that
// dbg.declare does.
if (isa<DbgDeclareInst>(DVI)) {
Instruction *InsertPt = nullptr;
if (auto *I = dyn_cast<Instruction>(Storage))
InsertPt = I->getInsertionPointAfterDef();
Expand Down
10 changes: 3 additions & 7 deletions llvm/lib/Transforms/Coroutines/CoroSplit.cpp
Expand Up @@ -1970,9 +1970,9 @@ splitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
// This invalidates SwiftErrorOps in the Shape.
replaceSwiftErrorOps(F, Shape, nullptr);

// Finally, salvage the llvm.dbg.{declare,addr} in our original function that
// point into the coroutine frame. We only do this for the current function
// since the Cloner salvaged debug info for us in the new coroutine funclets.
// Finally, salvage the llvm.dbg.declare in our original function that point
// into the coroutine frame. We only do this for the current function since
// the Cloner salvaged debug info for us in the new coroutine funclets.
SmallVector<DbgVariableIntrinsic *, 8> Worklist;
SmallDenseMap<llvm::Value *, llvm::AllocaInst *, 4> DbgPtrAllocaCache;
for (auto &BB : F) {
Expand All @@ -1981,10 +1981,6 @@ splitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
Worklist.push_back(DDI);
continue;
}
if (auto *DDI = dyn_cast<DbgAddrIntrinsic>(&I)) {
Worklist.push_back(DDI);
continue;
}
}
}
for (auto *DDI : Worklist)
Expand Down

0 comments on commit 29a6b7d

Please sign in to comment.