[PATCH] D146543: [Coroutines] Look for dbg.declare for temp spills
Wei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 09:59:17 PDT 2023
weiwang added a comment.
In D146543#4655210 <https://reviews.llvm.org/D146543#4655210>, @fdeazeve wrote:
> I understand the problem the patch is solving, but I haven't been able to figure out how we are going from that dbg.declare that I mentioned to the one that ends up in the final output of the compiler. Do you see the problem that I was trying to point to? The _first_ dbg.declare that we create -- the one shown in the output of `p CurrentBlock->dump()`-- is not equivalent to the original dbg.declare. And yet, somehow, this "invalid" dbg.declare disappears and the correct one shows up later. To be very specific, when we do:
>
> DIBuilder(*CurrentBlock->getParent()->getParent(), AllowUnresolved)
> .insertDeclare(CurrentReload, DDI->getVariable(),
> DDI->getExpression(), DDI->getDebugLoc(),
> &*Builder.GetInsertPoint());
>
> The `CurrentReload` argument seems incorrect if we stripped some of the loads along the way. Does that make sense?
I think the reason is that the reload `%this1.reload` is after a suspend point, so the `DbgDeclareInst ` (DDI) is unreachable from the ramp function and removed later. But since it is reachable in resume and destroy copies, it shows up there.
for (DbgDeclareInst *DDI : DIs) {
bool AllowUnresolved = false;
// This dbg.declare is preserved for all coro-split function
// fragments. It will be unreachable in the main function, and
// processed by coro::salvageDebugInfo() by CoroCloner.
DIBuilder(*CurrentBlock->getParent()->getParent(), AllowUnresolved)
.insertDeclare(CurrentReload, DDI->getVariable(),
DDI->getExpression(), DDI->getDebugLoc(),
&*Builder.GetInsertPoint());
// This dbg.declare is for the main function entry point. It
// will be deleted in all coro-split functions.
coro::salvageDebugInfo(ArgToAllocaMap, DDI, Shape.OptimizeFrame,
false /*UseEntryValue*/);
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146543/new/
https://reviews.llvm.org/D146543
More information about the llvm-commits
mailing list