diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-29 23:28:45 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-29 23:28:45 +0000 |
commit | 4d69a8c8b2133e441503ac9583c4a6056f52e0f3 (patch) | |
tree | c0e7d353a608817d9167e59eb5a917f50059cfea /include | |
parent | e160c53fbef056a3f121eeebcb7074f780bfae52 (diff) | |
download | external_llvm-4d69a8c8b2133e441503ac9583c4a6056f52e0f3.zip external_llvm-4d69a8c8b2133e441503ac9583c4a6056f52e0f3.tar.gz external_llvm-4d69a8c8b2133e441503ac9583c4a6056f52e0f3.tar.bz2 |
Explicitly cast an expression to bool before handing it off to __builtin_expect.
Avoids surprises when someone uses LLVM_(UN)LIKELY with an integer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/Compiler.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 28e4cc6..4f5b8f8 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -106,8 +106,8 @@ #endif #if (__GNUC__ >= 4) -#define LLVM_LIKELY(EXPR) __builtin_expect((EXPR), true) -#define LLVM_UNLIKELY(EXPR) __builtin_expect((EXPR), false) +#define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true) +#define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false) #else #define LLVM_LIKELY(EXPR) (EXPR) #define LLVM_UNLIKELY(EXPR) (EXPR) |