[llvm-dev] [RFC] Moving llvm.dbg.value out of the instruction stream

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 23 10:11:40 PDT 2018



> On Oct 23, 2018, at 9:53 AM, Adrian Prantl via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> [resending with a bugfix s/x/y/ in my example]
> 
> We still have to support constant dbg.values that need to be at a specific point in the instruction stream and don't refer to any SSA value.
> For example, we can still have code like this:
> 
>  int x = foo();
>  int y = 42;
>  bar();
>  y = x;
>  baz();
> 
> that might lower into IR like
> 
>  %x = call i32 @foo()
>  call void @llvm.dbg.value(i32 %x, DIVariable("x"), ...)
>  call void @llvm.dbg.value(i32 42, DIVariable("y"), ...)
>  call void @bar()
>  call void @llvm.dbg.value(i32 %x, DIVariable("y"), ...) ; %x is not materialized here, and we also can't hoist this.
>  call void @foo()

Maybe I am misunderstanding the proposal, but I would imagine this to be modeled similar to this:

%x = call i32 @foo() !debug-variable X0, !debug-variable Y1
call @bar()
call @foo()

now we have two tables for the X and Y debug variables:

X0 (line xxx-yyy)

Y0 - Constant 42  (line xxx-yyy)
Y1 (line yyy-zzz)

- Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181023/567509bc/attachment.html>


More information about the llvm-dev mailing list