Is there a nicer way to error than "llvm_unreachable" at CodeGen ?

I would like to error and abandon compilation during code generation
(after syntax/semantics is through), but not crash.


Caution: `llvm_unreachable` is absolutely *not* intended to report error. It is only asserting when assertions are enabled, and compiled out to “nothing” in release build.

We have report_fatal_error(“…”) for ICE (internal compiler error) when we want a behavior that is “assertions in release mode”, but that’s also not intended to happen (IMO): ideally it should *not* be possible to trigger it with valid IR (yeah we’re not doing a good job at it…).

So yes, you can diagnose an error properly, using the LLVMContext. For example open llvm/lib/Target/AMDGPU/SIISelLowering.cpp and search for: DAG.getContext()->diagnose(NoGraphicsHSA);