LLVM IR debug information with Numba

Good morning!

I am conducting a project where I am trying to obtain data dependencies of variables based on the LLVM IR. I also like to later show where these appear in the original source code. For this, I need the LLVM compile unit metadata where each line in the IR is mapped to where the according operations happen in the original source code. For C for example I can obtain this with

clang -g -O0 -S -emit-llvm 
int sum() {

int sum = 0; 
}
!11 = !DILocalVariable(name: "sum", scope: !7, file: !1, line: 3, type: !10)

however with

@jit
def reduce():

    sum = 0; 

I get just this

!0 = !{ !"branch_weights", i32 1, i32 99 }
!1 = !{ i1 1 }

Hi @Program1, try with debug=True. For instance:


@jit(debug=True, no_cfunc_wrapper=True)
def func(a):
    return a + 1

print(func(3))
print(func.inspect_llvm(func.signatures[0]))