<div dir="ltr">I don't believe so, no. The ScopeLine was added for adjusting profile samples & was just what was needed for that task - I don't think there's any equivalent column info.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 29, 2018 at 11:54 PM Muhui Jiang <<a href="mailto:jiangmuhui@gmail.com">jiangmuhui@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi David<div><br></div><div>Thank you very much for your suggestions. ScopeLine works well. It could represent the start of a function. Do you know whether I can get the start column of this function?  Many Thanks</div><div><br></div><div>Regards</div></div><div dir="ltr"><div>Muhui</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-05-30 3:25 GMT+08:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span><div dir="ltr">On Tue, May 29, 2018 at 5:25 AM Muhui Jiang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>I am using LLVM to help me do some code analysis. I wrote a LLVM Function Pass to help me to generate some information. I use the code below to get the source line information for every instruction. </div><div><br></div><div>for (BasicBlock &BB : F){<br></div><div>    for(Instruction &I: BB){</div><div>    DILocation* Loc =  I.getDebugLoc().get();<br></div><div>    unsigned Line = Loc->getLine()<br></div><div>    }</div><div>}</div><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I think the function's first block's first instruction's source line should be the beginning of the function.</span></div></div></blockquote></span><div><br>I'm not sure why that would necessarily be true - if there are no instructions associated with the beginning of the function. (no frame setup, no allocas, etc)<br> </div><span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"> Most of the functions inside the binary follow the rules. However, I found the file system.h in the coreutils-8.28 has a function like below:</span><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><div>611 static inline void</div><div>612 emit_backup_suffix_note (void)</div><div>613 {</div><div>614   fputs (_("\</div><div>615 \n\                                                                                            </div><div>616 The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n\</div><div>617 The version control method may be selected via the --backup option or through\n\</div><div>618 the VERSION_CONTROL environment variable.  Here are the values:\n\</div><div>619 \n\</div><div>620 "), stdout);</div><div>621   fputs (_("\</div><div>622   none, off       never make backups (even if --backup is given)\n\</div><div>623   numbered, t     make numbered backups\n\</div><div>624   existing, nil   numbered if numbered backups exist, simple otherwise\n\</div><div>625   simple, never   always make simple backups\n\</div><div>626 "), stdout);</div><div>627 }</div><div><br></div><div>When analysis this function. The first block's first instruction's source line is 614 rather than 612 or 613.</div></span></div></div></blockquote></span><div><br>The first instruction is the call to gettext (presumably expressed by the _ macro) that is on line 614. Doesn't look like there's any instruction that could/should be attributed to 612 or 613.<br><br>The DISubprogram describing the function should probably have some a "scopeLine" attribute of 613, which might be what you want.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div dir="ltr"><div><span style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><div> Is it a bug or any other meaning resulting in such case. Below is the IR. The first IR's source line if 614.</div><div><br></div><div><div>  %call = call i8* @gettext(i8* getelementptr inbounds ([221 x i8], [221 x i8]* @.str.42, i32 0    , i32 0)) #12, !dbg !1295</div><div>  %0 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 4, !dbg !1295</div><div>  %call1 = call i32 @fputs_unlocked(i8* %call, %struct._IO_FILE* %0), !dbg !1295</div><div>  %call2 = call i8* @gettext(i8* getelementptr inbounds ([222 x i8], [222 x i8]* @.str.43, i32     0, i32 0)) #12, !dbg !1296</div><div>  %1 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 4, !dbg !1296</div><div>  %call3 = call i32 @fputs_unlocked(i8* %call2, %struct._IO_FILE* %1), !dbg !1296</div><div>  ret void, !dbg !1297</div></div><div><br></div><div>Can anyone help me or give me some suggestions? Many Thanks</div><div><br></div><div>Regards</div><div>Muhui</div></span></div></div></span>
_______________________________________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>
</blockquote></div><br></div>
</blockquote></div>