[llvm-dev] RFC: Unify debug and optimized variable locations with llvm.dbg.addr [was: DW_OP_LLVM_memory]

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 7 14:00:58 PDT 2017


On Thu, Sep 7, 2017 at 12:01 PM, Adrian Prantl <aprantl at apple.com> wrote:
>
> Is the restriction precisely that all dbg.addr for the same variable/!dbg
> combination must describe the same alloca?
>

Yes, but there are cases where dbg.addr won't be based on an alloca. I
think the invariant should be that they all refer to the same SSA value.
Consider RVO cases, where it refers to the sret %agg.result parameter.


> I think I like this proposal for all the reasons that were discussed in
> the previous thread.
>

Great!

A couple of questions for my understanding:
> Your examples didn't show it, but I assume that dbg.addr will still allow
> a DIExpression (for things similarly complicated as block captures)?
>

Yes.


> What exactly is allowed as the first parameter of a dbg.addr? Only
> allocas? Anything else?
>

Any pointer value. Maybe we could allow pointer-sized integers, but that
anything else is probably indescribable. If the base pointer is in XMM0,
how would we describe that with DWARF?


> Should an sret parameter or similar be described by a dbg.addr?
>

Yes. We should be able to inline functions that use RVO, SROA the alloca
passed in for sret, and get good dbg.value instructions. Likewise for other
non-trivially copyable C++ objects passed by value as arguments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170907/90c7a4a6/attachment.html>


More information about the llvm-dev mailing list