[PATCH] D141381: [codegen] Store address of indirect arguments on the stack
Jeremy Morse via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 17 03:35:27 PST 2023
jmorse added a comment.
Hi,
In D141381#4056661 <https://reviews.llvm.org/D141381#4056661>, @fdeazeve wrote:
> While SROA will not touch this:
>
> define @foo(ptr %arg) {
> call void @llvm.dbg.declare(%arg, [...], metadata !DIExpression())
>
> It completely destroys the debug information provided by:
>
> define @foo(ptr %arg) {
> %ptr_storage = alloca ptr
> store ptr %arg, ptr %ptr_storage
> call void @llvm.dbg.declare(%ptr_storage, [...], metadata !DIExpression(DW_OP_deref))
Curious -- that feels like the kind of thing we should be able to support, but adding more "special handling" to SROA isn't great.
One alternative line of investigation could be to keep the codegen changes you're adding, but leave the dbg.declare unmodified, i.e. referring to the argument value. The dbg.declare will become an indirect DBG_VALUE after isel, and if nothing optimises away the stack store, then LiveDebugValues (both flavours) might be able to track the store to stack and leave the variable homed there. I tried fiddling with llvm/test/DebugInfo/X86/spill-indirect-nrvo.ll to make that happen, however LiveDebugValues didn't follow the store, probably because it's to an alloca not a spill slot, thus there might be aliasing stores.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141381/new/
https://reviews.llvm.org/D141381
More information about the cfe-commits
mailing list