[llvm-dev] Extracting the !dbg property from LLVM IR function calls (original) (raw)

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 8 11:29:39 PDT 2020


The !69 and !29 refer to metadata (look further down in the LLVM IR dump) that looks something like this:

!10 = !DILocation(line: 3, column: 3, scope: !7)

Which is where the 'line' value is stored (so the line is not 69 or 29).

When you extract the function, only the referenced metadata is brought with it, so it gets renumbered - but the semantics remain the same - the line/column/scope is preserved. It's just there's fewer metadata nodes, so the metadata node number is smaller.

On Wed, Jul 8, 2020 at 11:23 AM Shishir V Jessu via llvm-dev < llvm-dev at lists.llvm.org> wrote:

Hello,

I am compiling a program with debugging information, and am attempting to extract !dbg numbers from function calls in LLVM IR. However, I've found a few inconsistencies. For example, this call exists in my module: %1 = tail call i1 @llvm.type.test(i8* bitcast (i32 (i32)* @Z5otheri to i8*), metadata !"ZTSFiiE") #5, !dbg !69, !nosanitize !2 I would like to extract the 69 from this line in my LLVM pass, but when I dump() the corresponding CallInst, I see the following: %1 = tail call i1 @llvm.type.test(i8* bitcast (i32 (i32)* @Z5otheri to i8*), metadata !"ZTSFiiE") #5, !dbg !29, !nosanitize !2 And finally, the line CallInst -> getDebugLoc() -> getLine() returns 61 for this call, not 69 or 29. Am I misunderstanding the purpose of getDebugLoc() for a CallInst? Is there any way I can extract the correct !dbg for a given line? Thanks for your help! Best, Shishir Jessu


LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200708/674dcbf1/attachment.html>



More information about the llvm-dev mailing list