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

David Stenberg via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 31 01:58:11 PDT 2020


Hi!

On Tue, 2020-03-31 at 12:27 +0530, Sourabh Singh Tomar via llvm-dev 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". ?

Do you mean documenting the desired frontend behavior, or adding some verifier in
LLVM? A warning for the latter is that SROA may currently emit IR that contains a
mix of declares and values for different fragments of an aggregate variable, so I
assume that is something that would need to be fixed then.

Here is a ticket for that: https://bugs.llvm.org/show_bug.cgi?id=39314

In that case LLVM incorrectly emits a single location description using the
information from the declares, and ignores the values, which would have produced
a location list.

Best regards,
David

> 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.
> 
> Thanks,
> Sourabh.


More information about the llvm-dev mailing list