<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>The CMake default is an empty build type, which yield a non-optimized build without debug information and without assertions, it isn't clear that it is really good for most (developers likely want debug info and assertions in non-optimized builds, non developers may want a release build).</div><div>See also the revision that introduced the current behavior: <a href="http://reviews.llvm.org/D7360">http://reviews.llvm.org/D7360</a></div><div><br></div><div>We could make Release the default I guess, the main drawback I see right now is that it could affect bots that are relying on the default and wouldn't get assertions anymore?</div><div>That said our upstream buildbots infra seems to have explicit defaults: <a href="https://github.com/llvm/llvm-zorg/blob/master/zorg/buildbot/builders/UnifiedTreeBuilder.py#L125-L127">https://github.com/llvm/llvm-zorg/blob/master/zorg/buildbot/builders/UnifiedTreeBuilder.py#L125-L127</a></div><div><br></div><div>For LLD, I don't think we have auto-detection, but I'd be on-board with auto-detecting it and have -DLLVM_ENABLE_LLD default to the auto-detection when empty. But that's another topic...</div><div>-- </div><div>Mehdi</div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 17, 2020 at 5:50 PM David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></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">Yeah, that's one I'd be in favor of fixing, if it's still the case.<br>
<br>
On Tue, Nov 17, 2020 at 5:38 PM Sean Silva via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> I'm curious how much of this is due to not using LLD? Last I checked, using ld.bfd instead of LLD (or gold) was one of my major build time issues, and somehow our default configuration would use ld.bfd.<br>
><br>
> -- Sean Silva<br>
><br>
> On Tue, Nov 17, 2020 at 10:25 AM Luke Drummond via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Hi all<br>
>><br>
>> I wanted to do a quick build of a clean branch yesterday and noticed<br>
>> something surprising in the configure log:<br>
>><br>
>> > -- No build type selected, default to Debug<br>
>><br>
>> It appears that llvm's configuration forces Debug builds if the user<br>
>> does not specify the build type.<br>
>><br>
>>     <a href="https://github.com/llvm/llvm-project/blob/9218ff50f93085d0a16a974db28ca8f14bc66f64/llvm/CMakeLists.txt#L57-L60" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/9218ff50f93085d0a16a974db28ca8f14bc66f64/llvm/CMakeLists.txt#L57-L60</a><br>
>><br>
>> I've just done a build of llvm and clang 10 in debug mode for X86 and<br>
>> ARM targets and it weighs in at a whopping 75GiB. I feel that forcing<br>
>> Debug builds in the absence of an option to be a wasteful default. It is<br>
>> a valid and useful thing to call cmake without specifying a build type;<br>
>> absence of a command line switch does not always imply absence of a<br>
>> choice.<br>
>><br>
>> I took some measurements. The machine under test is an otherwise<br>
>> unloaded Ryzen 2 server with 6 cores / 12 threads and fast NVME SSDs<br>
>> running Debian sid with gcc-10.2 as the host toolchain.<br>
>><br>
>>     $ cmake ../llvm -DCMAKE_BUILD_TYPE=Debug -GNinja \<br>
>>         -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON<br>
>>     ...<br>
>>     $ time ninja llc<br>
>>     ...<br>
>>     [1199/1199] Linking CXX executable bin/llc<br>
>>     ninja llc  6858.95s user 218.53s system 1095% cpu 10:45.78 total<br>
>><br>
>> and then:<br>
>><br>
>>     $ git apply <<'EOF'<br>
>>     diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt<br>
>>     index 21563e15118..3f5821351a1 100644<br>
>>     --- a/llvm/CMakeLists.txt<br>
>>     +++ b/llvm/CMakeLists.txt<br>
>>     @@ -55,8 +55,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED YES)<br>
>>      set(CMAKE_CXX_EXTENSIONS NO)<br>
>><br>
>>       if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)<br>
>>       -  message(STATUS "No build type selected, default to Debug")<br>
>>       -  set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (default Debug)" FORCE)<br>
>>       +  # message(STATUS "No build type selected, default to Debug")<br>
>>       +  # set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (default Debug)" FORCE)<br>
>>        endif()<br>
>><br>
>>         # Side-by-side subprojects layout: automatically set the<br>
>>     EOF<br>
>><br>
>>     $ cmake ../llvm -DCMAKE_BUILD_TYPE= -GNinja -DLLVM_TARGETS_TO_BUILD=X86 \<br>
>>         -DCMAKE_EXPORT_COMPILE_COMMANDS=ON<br>
>>     ...<br>
>>     $ time ninja llc<br>
>>     [1199/1199] Linking CXX executable bin/llc<br>
>>     ninja llc  5714.52s user 159.31s system 1125% cpu 8:41.99 total<br>
>><br>
>> There's two minutes difference just for an X86 capable `llc` target on<br>
>> this machine. I imagine there are plenty of configurations in which the<br>
>> ratio is *much* larger e.g. machines with slow disks and lots of cores.<br>
>><br>
>> I think this speedup will be especially useful in CI systems where<br>
>> getting a compiler build quickly is more important than getting a quick<br>
>> compiler. I don't imagine we ever use the debuginfo generated by the<br>
>> host toolchain in the buildbots, either.<br>
>><br>
>> Is there anything I'm missing, or can this override be safely deleted?<br>
>> Would a patch to Zorg be needed / appropriate for the fast buildbots?<br>
>><br>
>> All the Best<br>
>><br>
>> Luke<br>
>><br>
>> --<br>
>> Codeplay Software Ltd.<br>
>> Company registered in England and Wales, number: 04567874<br>
>> Registered office: Regent House, 316 Beulah Hill, London, SE19 3HF<br>
>> _______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
> _______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>