[PATCH] D122167: Compiler: Remove empty fallback definition for LLVM_BUILTIN_UNREACHABLE
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 11:48:04 PDT 2022
dexonsmith created this revision.
dexonsmith added reviewers: aeubanks, mehdi_amini.
Herald added a project: All.
dexonsmith requested review of this revision.
Herald added a project: LLVM.
`llvm_unreachable()` and `LLVM_ASSUME_ALIGNED` use
`defined(LLVM_BUILTIN_UNREACHABLE)` to check whether it has a
definition. Remove the fallback added in 26827337dff26ba3 <https://reviews.llvm.org/rG26827337dff26ba3450721f880d4c6caaf2a8219> (as a drive-by
when updating the GCC logic) and add a comment to prevent future
mistakes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122167
Files:
llvm/include/llvm/Support/Compiler.h
Index: llvm/include/llvm/Support/Compiler.h
===================================================================
--- llvm/include/llvm/Support/Compiler.h
+++ llvm/include/llvm/Support/Compiler.h
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122167.417039.patch
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220321/3104db44/attachment.bin>
More information about the llvm-commits
mailing list