diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h --- a/llvm/include/llvm/Support/ErrorHandling.h +++ b/llvm/include/llvm/Support/ErrorHandling.h @@ -124,7 +124,9 @@ /// Marks that the current location is not supposed to be reachable. /// In !NDEBUG builds, prints the message and location info to stderr. -/// In NDEBUG builds, the behavior is controlled by the CMake flag +/// In NDEBUG builds, if the platform does not support a builtin unreachable +/// then we call an internal LLVM runtime function. Otherwise the behavior is +/// controlled by the CMake flag /// -DLLVM_UNREACHABLE_OPTIMIZE /// * When "ON" (default) llvm_unreachable() becomes an optimizer hint /// that the current location is not supposed to be reachable: the hint @@ -139,12 +141,12 @@ #ifndef NDEBUG #define llvm_unreachable(msg) \ ::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__) -#elif !LLVM_UNREACHABLE_OPTIMIZE -#define llvm_unreachable(msg) LLVM_BUILTIN_TRAP -#elif defined(LLVM_BUILTIN_UNREACHABLE) +#elif !defined(LLVM_BUILTIN_UNREACHABLE) +#define llvm_unreachable(msg) ::llvm::llvm_unreachable_internal() +#elif LLVM_UNREACHABLE_OPTIMIZE #define llvm_unreachable(msg) LLVM_BUILTIN_UNREACHABLE #else -#define llvm_unreachable(msg) ::llvm::llvm_unreachable_internal() +#define llvm_unreachable(msg) LLVM_BUILTIN_TRAP, LLVM_BUILTIN_UNREACHABLE #endif #endif