Dwarf debug info misses while clang codegen

I'm trying to write a llvm pass to add debug info into a non-debug-info bitcode
file. I have been read http://llvm.org/docs/SourceLevelDebugging.html. And I use
DIBuilder to produce the debug metadata. I know I can't get all information form
ir code . So I add some manual info as test data. After executing my pass, I can
find debug info metadata in my generated bitcode. Those metadata include
"DICompileUnit" , "DIFile", "DIVariable" ,"DISubprogram", "DILexicalBlock".

Just like

Likely your metadata is incorrect. You should also use replaceOperand not RAUW
with metadata. Metadata as defined is to be write once, read many. Also, as I've
stated in the past, I have no idea what you're doing or what you're trying
to accomplish with it though.