<div dir="ltr">The !69 and !29 refer to metadata (look further down in the LLVM IR dump) that looks something like this:<br><br>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">!10 = !DILocation(line: 3, column: 3, scope: !7)<br><br>Which is where the 'line' value is stored (so the line is not 69 or 29).<br><br>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.</span></p></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 8, 2020 at 11:23 AM Shishir V Jessu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hello, <br><br>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: <br><font face="monospace"><br>%1 = tail call i1 @llvm.type.test(i8* bitcast (i32 (i32)* @_Z5otheri to i8*), metadata !"_ZTSFiiE") #5, <b>!dbg !69</b>, !nosanitize !2</font><br><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">I would like to extract the 69 from this line in my LLVM pass, but when I </font><font face="monospace">dump()</font><font face="arial, sans-serif"> the corresponding </font><font face="monospace">CallInst</font><font face="arial, sans-serif">, I see the following: <br><br></font><font face="monospace">%1 = tail call i1 @llvm.type.test(i8* bitcast (i32 (i32)* @_Z5otheri to i8*), metadata !"_ZTSFiiE") #5, <b>!dbg !29</b>, !nosanitize !2<br></font><br>And finally, the line <b>CallInst -> getDebugLoc() -> getLine()</b> returns <b>61</b> for this call, not 69 or 29.<div></div></div><div><br></div><div>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!<br><br>Best, <br>Shishir Jessu</div></div>
</div><img src="https://my-email-signature.link/signature.gif?u=452460&e=103509545&v=2963818b9a200211bcb9915dd11393987de0aebacda89486f056a807146e3f39" style="width: 2px; max-height: 0px; overflow: hidden;">
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>