[LLVMdev] Disabling assertions in llvm.org releases
edwintorok at gmail.com
Sun Jun 20 13:50:57 PDT 2010
On 06/20/2010 11:11 PM, Duncan Sands wrote:
> Currently LLVM releases, as downloaded from llvm.org, have assertions enabled.
> (I'm told Apple ships LLVM with assertions disabled, which is why I mention
> llvm.org here). What do people think of disabling assertions?
> The advantage of disabling assertions is that LLVM runs faster. I don't know
> how much faster. It also makes for fairer comparisons with gcc releases, which
> have all but the cheapest checks disabled.
> The disadvantage of disabling assertions is that we get less information in bug
> An additional consideration here is clang: while LLVM itself is reasonably
> mature, that's not the case for clang. I don't know if it is practical to
> ship LLVM with assertions disabled, and clang with assertions enabled.
> A different possibility is to analyse which checks are the most expensive,
> and just disable those.
I am running with assertions enabled and it was very useful in finding
bugs on platforms I can't (or rarely) test on.
Had assertions been off I think bad/invalid code would have been
generated silently, resulting in a much harder to debug segfault.
There are certain assertions that shouldn't be disabled IMHO.
Like those in codegen that check for "impossible" conditions, or
conditions under which codegen can't continue.
For example the assertions about relocations being in bounds on PowerPC.
Perhaps these shouldn't be assertions at all, but there are far too many
asserts to go over them one-by-one now and decide on converting to
Maybe we should convert the "cheap" (invoked once per instruction at
most) assert checks to something else, and then you could turn off the
rest of the assertions.
More information about the llvm-dev