[llvm-commits] [llvm] r149808 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
baldrick at free.fr
Mon Feb 6 03:04:06 CST 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:
> but more recently, John McCall has recommended using llvm_unreachable:
> 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.
More information about the llvm-commits