<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 16, 2020, at 11:04 AM, David Major <<a href="mailto:dmajor@mozilla.com" class="">dmajor@mozilla.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">This sounds a lot like <a href="https://bugs.llvm.org/show_bug.cgi?id=45050" class="">https://bugs.llvm.org/show_bug.cgi?id=45050</a>. </div></div></div></blockquote><div>Yeah I think that bug is the same as this one. I’ve also left a comment there to point out my patch review.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">I'm glad to hear you figured out the root cause, thank you!</div></div></div></blockquote><div><br class=""></div><div>Best</div>-Min<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 16, 2020 at 1:55 PM Min-Yih Hsu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class="">Hi All,<div class=""><br class=""></div><div class="">Recently we discovered a (hidden) performance bug that happened when you’re using Full LTO setup + BFD linker to compile first-stage PGO executables that were expected to generate IR level profile files. That is, compiling an executable using following commands:</div><div class="">```</div><div class=""><span id="gmail-m_-3301276180455801308docs-internal-guid-f9f404e4-7fff-965f-b7be-db6283532868" class=""><span style="font-size: 12pt; font-family: "Courier New"; font-variant-ligatures: normal; font-variant-east-asian: normal; vertical-align: baseline; white-space: pre-wrap;" class="">clang -flto -fprofile-generate -c sample.c -o sample.c.bc.o</span></span></div><div class=""><span id="gmail-m_-3301276180455801308docs-internal-guid-25b12471-7fff-b740-bb93-56de3e65db05" class=""><span style="font-size: 12pt; font-family: "Courier New"; font-variant-ligatures: normal; font-variant-east-asian: normal; vertical-align: baseline; white-space: pre-wrap;" class="">clang -flto sample.c.bc.o -o sample_exe -fprofile-generate</span></span></div><div class="">```</div><div class="">The resulting sample_exe executable will <i class="">always</i> emit Frontend level profile files despite the presence of the -fprofile-generate flag, which should make the executable generate IR level profile files. Other prerequisites to reproduce this problem including:</div><div class=""><div class=""><span style="white-space:pre-wrap" class=""> </span>• Using (latest version of) BFD linker<br class=""></div><div class=""><span style="white-space:pre-wrap" class=""> </span>• Using LLVM’s own LTO linker plugin (i.e. LLVMgold.so)<br class=""></div><div class=""><span style="white-space:pre-wrap" class=""> </span>• Using LLVM’s compiler-rt as the runtime library<br class=""></div><div class=""><span style="white-space:pre-wrap" class=""> </span>• On a Linux / BSD platform</div></div><div class="">This problem has been confirmed <i class="">not</i> to happen with gold and LLD linkers. Impacts on usages on Windows platform remain unknown.</div><div class=""><br class=""></div><div class="">I just cooked a patch for this bug: <a href="https://reviews.llvm.org/D83967" target="_blank" class="">https://reviews.llvm.org/D83967</a></div><div class="">Basically the solution (and the root cause) is similar to this patch several years ago: <a href="https://reviews.llvm.org/D34797" target="_blank" class="">https://reviews.llvm.org/D34797</a></div><div class=""><br class=""></div><div class="">The intriguing (or annoying) part of this bug is that you’ll never find the issue (since it neither crashes nor causes significant performance regression) unless you take a look into the generated profile files. So I just want to put a heads up here, though I know most of the folks here are moving away from using BFD linkers.</div><div class=""><br class=""></div><div class="">Best,</div><div class="">-Min</div></div>_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>