<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 8, 2017 at 2:31 PM, Davis, Alan via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.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">
<div lang="EN-US">
<div class="gmail-m_8549496858033981169gmail-m_-1931200739113205042WordSection1">
<p class="MsoNormal">I’m trying to incorporate thinLTO into our proprietary linker. I can’t seem to make it work at all (although I do have the ‘thick’ form working). </p></div></div></blockquote><div><br></div><div>Sorry to hear that, hopefully we can help get that sorted out.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_8549496858033981169gmail-m_-1931200739113205042WordSection1"><p class="MsoNormal">When I try to invoke the ThinGenerator API it crashes somewhere way down in the bowels of
IPO. So stepping away from the linker, I am just trying to explore the processing steps using standalone off-the shelf llvm built from tip-of-tree.</p></div></div></blockquote><div><br></div><div>For a new implementation I would highly recommend using the new LTO API, which utilizes linker resolution info and is better supported at this point. See <a href="http://llvm-cs.pcc.me.uk/include/llvm/LTO/LTO.h#234" target="_blank">http://llvm-cs.pcc.me.uk/<wbr>include/llvm/LTO/LTO.h#234</a>.</div><div>See also gold-plugin.cpp and the lld sources - both utilize this API. To test it use the llvm-lto2 tool instead of llvm-lto. Because this interface uses linker resolution info, invoking via llvm-lto2 is more tedious since resolutions must be specified for all symbols in the input files. See invocations in the llvm tests for examples.</div><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"><div lang="EN-US"><div class="gmail-m_8549496858033981169gmail-m_-1931200739113205042WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">1. When I do ‘clang -c -flto=thin t1.c’ on a simple input file, the resulting .o file is a bitcode file as expected, but when I llvm-dis it there is no evidence of the module summary information. Is there a way to view the summary index
for a given module?</p></div></div></blockquote><div><br></div><div>Unfortunately not. This has come up a few times and the long-term plan is to serialize it through llvm assembly, but no one has had the bandwidth to completely flesh this out yet, and there was disagreement about what to do in the short term, so nothing went in. For now, you have to use llvm-bcanalyzer -dump, but that is a raw output format, although it will at least allow you to confirm the summary sections are there.</div><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"><div lang="EN-US"><div class="gmail-m_8549496858033981169gmail-m_-1931200739113205042WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">2. When I take two or three .o files generated using -flto=thin and pass them to the standalone llvm-lto tool, as in:<u></u><u></u></p>
<p class="MsoNormal"> llvm-lto --thinlto t2.o t3.o --exported-symbol=t2 -o index<u></u><u></u></p>
<p class="MsoNormal">the combined index is (apparently) empty.</p></div></div></blockquote><div><br></div><div>Use llvm-bcanalyzer -dump to see the contents of the output index. It shouldn't be empty. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_8549496858033981169gmail-m_-1931200739113205042WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">3. When I take a program and pass all the .o files to llvm-lto --thinlto-action=run, I get recompiled .o files for each but there seems to be no IPO (no inlining, etc).</p></div></div></blockquote><div><br></div><div>How do you know? BTW you can invoke llvm-lto with the -thinlto-save-temps=<<wbr>pathprefix> option to get bitcode files emitted from the backends after the major phases of ThinLTO backend compilation. I.e. to see what was imported.</div><div>You can also pass internal llvm options to llvm-lto, i.e. -debug-only=function-import will give you debug info from the function importing done both during the thin link and during the thinlto backends.</div><div><br></div><div>Let me know what you find.</div><div><br></div><div>Teresa</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_8549496858033981169gmail-m_-1931200739113205042WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">What am I missing?<span class="gmail-m_8549496858033981169gmail-HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="gmail-m_8549496858033981169gmail-HOEnZb"><font color="#888888">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-Alan<u></u><u></u></p>
</font></span></div>
</div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail-m_8549496858033981169gmail_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>
</div></div>