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

Eric Christopher echristo at gmail.com
Thu Jun 19 11:01:06 PDT 2014


On Thu, Jun 19, 2014 at 10:21 AM, Reid Kleckner <rnk at google.com> wrote:
> On Thu, Jun 19, 2014 at 9:28 AM, Duncan P. N. Exon Smith
> <dexonsmith at apple.com> wrote:
>>
>>
>> > 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.
>
>
> The message also serves as documentation to the reader about why this
> particular point is unreachable, so I'd like to keep them.
>

Agreed :)

-eric



More information about the llvm-commits mailing list