<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I have no strong opinion on this topic personally (I always set the build type to something if I’m not generating a Visual Studio project), but this “non-optimized, non-asserting, non-debug-info-containing” build that you get when not specifying
the build type to CMake is a quirk that I feel most CMake users expect at this point. I don’t think there’s any real value in providing a useful default if nobody accepts the default anyways due to having been burned in the past.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"> Christopher Tetreault<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> <b>On Behalf Of
</b>Mehdi AMINI via llvm-dev<br>
<b>Sent:</b> Tuesday, November 17, 2020 7:16 PM<br>
<b>To:</b> Luke Drummond <luke.drummond@codeplay.com><br>
<b>Cc:</b> llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> [EXT] Re: [llvm-dev] wasteful cmake defaults<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">See also the revision that introduced the current behavior: <a href="http://reviews.llvm.org/D7360">
http://reviews.llvm.org/D7360</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-- <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Mehdi<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">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" 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" 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" 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" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>