Skip to content

Commit

Permalink
Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
Browse files Browse the repository at this point in the history
`llvm_unreachable()` and `LLVM_ASSUME_ALIGNED` use
`defined(LLVM_BUILTIN_UNREACHABLE)` to check whether it has a
definition. Remove the fallback added in 2682733 (as a drive-by
when updating the GCC logic) and add a comment to prevent future
mistakes.

Differential Revision: https://reviews.llvm.org/D122167
  • Loading branch information
dexonsmith committed Mar 21, 2022
1 parent 1844054 commit 892c104
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions llvm/include/llvm/Support/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,14 @@
/// LLVM_BUILTIN_UNREACHABLE - On compilers which support it, expands
/// to an expression which states that it is undefined behavior for the
/// compiler to reach this point. Otherwise is not defined.
///
/// '#else' is intentionally left out so that other macro logic (e.g.,
/// LLVM_ASSUME_ALIGNED and llvm_unreachable()) can detect whether
/// LLVM_BUILTIN_UNREACHABLE has a definition.
#if __has_builtin(__builtin_unreachable) || defined(__GNUC__)
# define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
#elif defined(_MSC_VER)
# define LLVM_BUILTIN_UNREACHABLE __assume(false)
#else
# define LLVM_BUILTIN_UNREACHABLE
#endif

/// LLVM_BUILTIN_TRAP - On compilers which support it, expands to an expression
Expand Down

0 comments on commit 892c104

Please sign in to comment.