<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=""><div class="">(Sorry for the late response, I was out of town for the holiday)</div><div class=""><br class=""></div>There is a little bit of internal magic for how AppleClang is built, but much of the essential configuration is in the public tree and documented here:<div class=""><a href="https://llvm.org/docs/AdvancedBuilds.html#apple-clang-builds-a-more-complex-bootstrap" class="">https://llvm.org/docs/AdvancedBuilds.html#apple-clang-builds-a-more-complex-bootstrap</a></div><div class=""><br class=""></div><div class="">Apple also uses PGO and order files for the AppleClang builds, and there is PGO infrastructure publicly documented here:</div><div class=""><a href="https://llvm.org/docs/AdvancedBuilds.html#multi-stage-pgo" class="">https://llvm.org/docs/AdvancedBuilds.html#multi-stage-pgo</a></div><div class=""><br class=""></div><div class="">That PGO infrastructure can also generate linker order files on Darwin. Unfortunately Apple's PGO training data is internal, so you'll need to come up with your own test cases for that. I would love to see more comprehensive training data in the open source tree, right now the only test we have is under clang/utils/perf-training, and it is a simple c++ hello world.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 21, 2018, at 7:43 AM, Jean-Daniel via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Thank you for the correction. So they actually did change that at some point.</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""><blockquote type="cite" class=""><div class="">Le 20 nov. 2018 à 23:54, Jack Howarth <<a href="mailto:howarth.mailing.lists@gmail.com" class="">howarth.mailing.lists@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Jean-Daniel,<div class="">     The latest available release posted on their open source web site argues that that they are disabling assertions in clang.</div><div class=""><br class=""></div><div class=""><a href="https://opensource.apple.com/source/clang/clang-800.0.42.1/Makefile.auto.html" class="">https://opensource.apple.com/source/clang/clang-800.0.42.1/Makefile.auto.html</a><br class=""></div><div class=""><br class=""></div><div class="">     Jack</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Nov 20, 2018 at 5:21 PM Jean-Daniel <<a href="mailto:mailing@xenonium.com" class="">mailing@xenonium.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class="" style="word-wrap: break-word; line-break: after-white-space;">I don’t think Apple disable assertion on the release build. I remember having clang and llvm crash because of assertion failure regularly at some point in the past.<div class="">Nowadays, it is far more unusual to get a clang crash, so I can’t tell, but I doubt they change the configuration.<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Le 20 nov. 2018 à 16:32, Jack Howarth via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> a écrit :</div><br class="m_-6078331054769411654Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class="">The obvious question is whether the<span class="Apple-converted-space"> </span><a href="http://llvm.org/" target="_blank" class="">llvm.org</a><span class="Apple-converted-space"> </span>builds are using -D<span class="" style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; font-variant-ligatures: normal; white-space: pre-wrap;">LLVM_ENABLE_ASSERTIONS:OFF </span><span class="" style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; white-space: pre-wrap;">-DCMAKE_BUILD_TYPE:STRING=</span><span class="" style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; white-space: pre-wrap;">Release </span><span class=""><font color="#24292e" face="SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace" class=""><span class="" style="font-size: 12px; white-space: pre-wrap;">-DLLVM_LINK_LLVM_DYLIB:BOOL=ON which would improve the load time of the compiler by combining all of the llvm libs into a single dylib and would eliminate the speed decrease from using the default use of </span><span class="" style="font-size: 12px; white-space: pre-wrap;">assertions in the built compiler</span><span class="" style="font-size: 12px; white-space: pre-wrap;">.</span></font></span></div><div class=""><span class=""><font color="#24292e" face="SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace" class=""><span class="" style="font-size: 12px; white-space: pre-wrap;">       Jack</span></font></span></div></div></div></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Nov 20, 2018 at 6:56 AM Tobias Hieta via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class="">Hello LLVM/Clang developers,</div><div class=""><br class=""></div><div class="">We recently switched to use the same clang version on all our platforms. This included switching from apple-clang from xcode to a pre-built binary we downloaded from<span class="Apple-converted-space"> </span><a href="http://llvm.org/" target="_blank" class="">llvm.org</a>. We noticed that this actually came with a pretty big performance regression in compile times.</div><div class=""><br class=""></div><div class="">If we do the simplest test program like this:</div><div class=""><br class=""></div><div class="">#include <string><br class="">#include <iostream><br class="">int main()<br class="">{<br class="">    std::cout << "Hello world" << std::endl;<br class="">}</div><div class=""><br class=""></div><div class="">and compile that with Xcode Clang (Xcode 10.1 apple-clang clang-1000.11.45.5):</div><div class="">clang++ test.cpp -o test  0.31s user 0.06s system 97% cpu 0.380 total</div><div class=""><br class=""></div><div class="">with clang 7 binaries found on<span class="Apple-converted-space"> </span><a href="http://llvm.org/" target="_blank" class="">llvm.org</a><span class="Apple-converted-space"> </span>7.0.0:</div><div class="">~/Downloads/clang+llvm-7.0.0-x86_64-apple-darwin/bin/clang++ -o test test.cpp  0.53s user 0.11s system 62% cpu 1.032 total</div><div class=""><br class=""></div><div class="">If we now run that on our whole project:</div><div class="">with xcode clang:</div><div class="">368.17s user 32.00s system 663% cpu 1:00.30 total</div><div class=""><br class=""></div><div class="">with clang 7:</div><div class="">423.31s user 31.65s system 662% cpu 1:08.69 total</div><div class=""><br class=""></div><div class="">That's a pretty hefty difference. Any ideas what can account for this discrepancy? Does apple-clang contain any special patches or build flags that differ a lot from the binaries on<span class="Apple-converted-space"> </span><a href="http://llvm.org/" target="_blank" class="">llvm.org</a>?</div><div class=""><br class=""></div><div class="">I know about PGO - and I guess the best we could do is to get profile data out of compiling my whole tree and use that when building clang - but this process seems not very well documented and unsure if this would even help.</div><div class=""><br class=""></div><div class="">Thankful for any ideas or feedback.</div><div class="">Tobias<br class=""></div></div></div></div></div></div></div></div>_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""></blockquote></div>_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div></div></blockquote></div><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">cfe-dev mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:cfe-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">cfe-dev@lists.llvm.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></div></blockquote></div><br class=""></div></body></html>