[llvm] r211254 - Convert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Jun 19 09:28:57 PDT 2014


> On 2014-Jun-19, at 00:03, Alp Toker <alp at nuanti.com> wrote:
> 
> 
> On 19/06/2014 09:10, Craig Topper wrote:
>> Author: ctopper
>> Date: Thu Jun 19 01:10:58 2014
>> New Revision: 211254
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=211254&view=rev
>> Log:
>> Convert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.
> 
> 
> Hi Craig,
> 
> While working on this commit did you get a feel for whether we could get rid of the llvm_unreachable() string parameter?
> 
> The llvm_unreachable("Unexpected enum value/XYZ") messages always looked less-than-useful to me. Unlike asserts they get used in places that are genuinely unreachable, even used as an optimisation hint in release builds. As a result the strings are seldom seen, making the small but conscious effort it takes to write them somewhat demeaning.
> 
> Alp.

They also get used in places that are supposed to be unreachable, but aren't.  When
we get a crash, I think it's good to know why.

At least, I appreciate the messages.



More information about the llvm-commits mailing list