Llvm_unreachable is widely misused

AFAIK there are multiple active projects that are continuously fuzzing LLVM/Clang.

Some examples:

Any additional efforts could be very valuable. Especially the LLVM IR fuzzers are quite limited in the type of candidates they currently produce AFAIK.

FYI this is how one dependent project (IREE) resolved this conversation. Replace llvm_unreachable by assert(false) or pass failures by bjacob · Pull Request #8521 · iree-org/iree · GitHub

It’d be interesting to systematically replace

I think that’s a great idea to experiment with!
It is also a trivial CMake flag to get this behavior available I think: ⚙ D121750 Add a cmake flag to turn `llvm_unreachable()` into builtin_trap() when assertions are disabled

This landed FYI: Add a cmake flag to turn `llvm_unreachable()` into builtin_trap() whe… · llvm/llvm-project@6316129 · GitHub

Especially the LLVM IR fuzzers are quite limited in the type of candidates they currently produce AFAIK.

I scanned through LLVM’s code, seems we have already had a IR fuzzing framework (llvm/lib/FuzzMutate).

Is that everything we have? I do plan on doing some work on IR fuzzing.