<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 10, 2017 at 12:37 PM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Jul 10, 2017 at 12:30 PM, Peter Collingbourne via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">pcc added a comment.<br>
<span class="m_-1490375058014472153m_-7226308486697307150gmail-"><br>
> the global VST (for the global values we will have in the index) does not.<br>
<br>
</span>Not quite, global VSTs include a reference to the symbol name in the strtab.<br></blockquote><div><br></div></span><div>That's what I was thinking when we chatted about this with Haojie, but it turns out I was wrong. The global VST includes the value id and the bitcode offset of the function definition in the IR:</div><div> <a href="http://llvm-cs.pcc.me.uk/lib/Bitcode/Writer/BitcodeWriter.cpp#2763" target="_blank">http://llvm-cs.pcc.me.uk/lib/<wbr>Bitcode/Writer/BitcodeWriter.c<wbr>pp#2763</a></div><div><br></div><div>The offset to the symbol name is included in the MODULE_CODE_FUNCTION entry:</div><div><a href="http://llvm-cs.pcc.me.uk/lib/Bitcode/Writer/BitcodeWriter.cpp#1170" target="_blank">http://llvm-cs.pcc.me.uk/lib/B<wbr>itcode/Writer/BitcodeWriter.cp<wbr>p#1170</a><br></div><div>which is not really in the global VST.</div></div></div></div></blockquote><div><br></div><div>Of course, I totally forgot about that.</div><div><br></div><div>I wonder whether it would be better to emit MODULE_CODE_FUNCTION (etc.) records into the minimised bitcode file, but of length 5 so that they include only the name and the linkage. Then there will be no special handling required in the index bitcode reader.</div><div><br></div><div>Peter</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="m_-1490375058014472153m_-7226308486697307150gmail-"><br>
> But I think infer it from the code in my previous inline comment, it is "we need the name to recompute a GUID for internal symbol promoted to global", correct?<br>
<br>
</span>Names of globals are also necessary for symbol resolution.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D35189" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3518<wbr>9</a><br>
<br>
<br>
<br>
</blockquote></span></div><br><br clear="all"><span><div><br></div>-- <br><div class="m_-1490375058014472153m_-7226308486697307150gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> <a href="tel:(408)%20460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-1490375058014472153gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div>