Status of __builtin_unreachable in clang

The GCC optimizer exploits statements like

   if (x < 0) __builtin_unreachable();

to infer that x must be non-negative. This way one can communicate value constraints to the optimizer that the optimizer otherwise couldn't infer itself. MSVC supports the __assume intrinsic for the same purpose.

clang/LLVM currently does not seem to be able to exploit __builtin_unreachable() in this way. I'm curious, are there any plans to change this in the future?

I found this related note by Chris Lattner:

- Stephan

I have moved this thread to llvmdev.

See also 810 – Make better use of conditional unreachable's in LLVM