[PATCH] D124153: [CMake] Change default CMAKE_BUILD_TYPE to Release

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 05:23:28 PDT 2022


mstorsjo added a comment.

In D124153#3464399 <https://reviews.llvm.org/D124153#3464399>, @zero9178 wrote:

> Are there any numbers as to how much slower an assertion build in Release mode is? I can see some benefits in having assertions turned on if no build type is specified:
>
> - Assertion failures have nicer error messages in bug reports than segmentation faults caused by violated pre-conditions
> - It could potentially catch miscompiles or similar that would otherwise go unnoticed

Yes, when using a random git build of llvm, enabling assertions is kinda important as bugs otherwise are much harder to notice. If a user builds a final release, it's less important though.

Anecdotally, I measured the slowdown incurred by assertions in a release build a couple years ago; it was in the order of magnitude of 30% slower than a regular Release build. I.e. measurably and noticably slower, but still tolerably slower given that you're running a bleeding edge, possibly broken compiler.

> I definitely am against having it default to on when a user specified the build type to be release explicitly however.

Indeed, that would break dozens of distribution packagers who just do a `cmake -DCMAKE_BUILD_TYPE=Release` build without explicitly setting anything about assertions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124153/new/

https://reviews.llvm.org/D124153



More information about the llvm-commits mailing list