Debug info error on bitcode inline modification

Hi,

I’m trying to inline function defined in another bitcode module via bitcode modification.
I’m linking multiple bitcode modules, setting inline related attributes, applying -always-inline pass, but then debug info error occurs.
It seems debug info metadata isn’t properly updated on inlining. How can I fix it?
I’m using LLVM 3.8.1 on OS X (On below example target is Android but it should be same on others).
I’ll appreciate any advice. Thanks.

  • Targets
    caller.cpp

Every inlinable call in a function that has debug info (F->getSubprogram() returns non-null) must have a DebugLoc associated with it that has a scope chain that ends in that same DISubprogram.

https://llvm.org/docs/SourceLevelDebugging.html discusses some of the debug info IR metadata in LLVM.

Every inlinable call in a function that has debug info (F->getSubprogram() returns non-null) must have a DebugLoc associated with it that has a scope chain that ends in that same DISubprogram.

Thank you for the comment! I don’t know if this is a proper way to fix, but after I add DebugLoc same as inserting position instruction, no error occurs.

Yeah, that should work OK (: