[llvm-dev] Question WRT llvm.dbg.value

Adrian Prantl via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 31 08:03:02 PDT 2020

> On Mar 30, 2020, at 11:57 PM, Sourabh Singh Tomar <sourav0311 at gmail.com> wrote:
>> > My understanding is that this isn't correct: dbg.declare specifies the
>> memory address of a variable for the whole lifetime of the function,
>> whereas dbg.value (and dbg.addr) specify the value/address until the
>> next debug intrinsic. Mixing these two kinds of intrinsics creates
>> ambiguity over where the variable location is at different positions
>> in the code.
>           > Correct, you should not be mixing dbg.declare and other instrinsics for the same variable
> How about patching up llvm for the same, currently the IR showed above is valid and can be processed by llvm for target code generation.
> Should we move ahead invalidate this behavior as in "declare and value intrinsic can't be specified for same local variable". ?
> So that no FE should generate this sort of thing in first place. clang doesn't do that so this change should not affect clang.

Adding this to the Verifier sounds like a good idea to me. It may be possible that this uncovers existing bugs in the current flow, but that would be a good thing.

-- adrian

More information about the llvm-dev mailing list