Joachim Durchholz
2010-Jun-20 21:03 UTC
[LLVMdev] Disabling assertions in llvm.org releases
Török Edwin schrieb:> Had assertions been off I think bad/invalid code would have been > generated silently, resulting in a much harder to debug segfault.Just a thought: how about distributing a "production build" with only the most important assertions active, and a "diagnostic build" that has all assertion checking on? In that case, if there's "funny behaviour" in the generated code, people can be instructed to try running their code through diagnostic build and see whether it assertion checks. Or they could be told to use the diagnostic LLVM when building production code just to be sure, but normally, the standard build will suffice. Regards, Jo
On 20 June 2010 22:03, Joachim Durchholz <jo at durchholz.org> wrote:> In that case, if there's "funny behaviour" in the generated code, people > can be instructed to try running their code through diagnostic build and > see whether it assertion checks.Userland don't tend to have source trees to build with diagnostic flags. Maybe if distributions had two packages (prod / diag) that could make it easier. Run time checks are no good, too. The similar of a -vvv flag would avoid multiple versions of the compiler installed, but that also has performance issues, as you always have the "if (diag_level > X)" before each assert. As always, a trade off. Btw, has anyone measured the delay of full assertions compared to no assertions at all? We may be discussing over nothing... cheers, --renato
Hi Renato,> Btw, has anyone measured the delay of full assertions compared to no > assertions at all? We may be discussing over nothing...I measured the effect of turning assertions off when compiling a huge file (gcc.c from http://people.csail.mit.edu/smcc/projects/single-file-programs/) using dragonegg, and when using opt and llc on the unoptimized bitcode: * gcc-4.5+dragonegg -S -O3 -> 22% faster with assertions off * opt -std-compile-opts -> 22% faster with assertions off * llc -> 16% faster with assertions off So turning assertions off seems to give a significant speed-up. Ciao, Duncan.