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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to