DW_AT_location not getting generated for local variables

I figured out my previous problem with DIBuilder. However, now I can’t seem to get the compiler to emit location information for local variables. Here’s how my IR looks:

I found the problem. The llvm.dbg.declare call must have a !dbg tag,
otherwise the location info is not generated. Changing the invocation
in my original example to "call void @llvm.dbg.declare(metadata !{i32*
%"bar:Int32"}, metadata !13), !dbg !16" causes MC to generate the
local location as expected.

-Joe

Hi Joe,