[llvm-commits] [PATCH] [MIPS] Avoid use of __builtin_unreachable() when compiling LLVM for MIPS.

Petar Jovanovic petar.jovanovic at rt-rk.com
Thu Mar 22 15:50:29 PDT 2012


There is a GCC bug which can be triggered inside of LLVM library. The -O2 opt
does not work well with __builtin_unreachable(), so we are avoiding it inside
of LLVM. The issue seems to be caused by 'freorder-blocks' optimization.

Signed-off-by: Petar Jovanovic <petarj at mips.com>
---
 include/llvm/Support/Compiler.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 9c5e7ec..b5a086a 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -144,9 +144,11 @@
 // 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.
+#if !defined(__mips__)
 #if defined(__clang__) || (__GNUC__ > 4) \
  || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 # define LLVM_BUILTIN_UNREACHABLE __builtin_unreachable()
 #endif
+#endif
 
 #endif
-- 
1.7.5.4




More information about the llvm-commits mailing list