[llvm-commits] [llvm] r149808 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Duncan Sands baldrick at free.fr
Mon Feb 6 01:04:06 PST 2012


...
>> Maybe I'm misremembering, but I thought the conclusion last time this came up
>> was that llvm_unreachable should only be used in cases where it was needed to
>> mark unreachable code, not to replace assert. Unless I missed something, the
>> preferred idiom for "shouldn't be reachable" switch cases is to put them at
>> the beginning of the switch with an assert. In a release build, they'll fall
>> through but that's no different than any other situation where things fall
>> apart when an assertion is not satisfied.
>
> Some digging shows that indeed I did miss something…. I was remembering Chris
> expressing a preference for assert:
>
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110110/115042.html
>
> but more recently, John McCall has recommended using llvm_unreachable:
>
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110919/046498.html
>
> Sorry for the noise.

Can this please then be clearly documented in doc/ProgrammersManual.html or
somewhere like that, so that discussion can be laid to rest once and for all.

Ciao, Duncan.



More information about the llvm-commits mailing list