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

Sourabh Singh Tomar via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 30 00:08:55 PDT 2020

Hello Everyone,

I have general question WRT llvm.dbg.value intrinsic function semantics.

Under what circumstances should a frontend choose to emit(at -O0(No
optimization)) llvm.dbg.value for a local variable.

I saw some debuginfo code in flang(older one), sort of it choose to emit
*llvm.dbg.value* for *every load operation* happening on a *local
variable*. And as noted below in IR snippet it has already emitted
*llvm.dbg.declare* for the local variable.

IR snippet of a subprogram from flang -
 call void @llvm.dbg.declare(metadata i32* %foo, metadata !9, metadata
!DIExpression()), !dbg !11
%0 = load i32, i32* %foo, align 4, !dbg !13
  call void @llvm.dbg.value(metadata i32 %0, metadata !9, metadata
!DIExpression()), !dbg !11

*Please note here, that IR snippet is generated by flang(at -O0),  so no
clang/llvm intervention happening till this point. After this llvm takes
over this IR for final target code generation.

Can anybody provide some clarity WRT this.

Thanks a lot!
Sourabh Singh Tomar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200330/ca1f7e1a/attachment-0001.html>

More information about the llvm-dev mailing list