(original) (raw)

\[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()

-- adrian