aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/ARM/trap.ll
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2012-10-19 20:11:16 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2012-10-19 20:11:16 +0000
commit970755e5197afb42a76a24a74cd6dc17721daf50 (patch)
tree6cfad3c8b2c649d34e247dfa22c2a1c73af9cdac /test/CodeGen/ARM/trap.ll
parent9abfbdfc77efe715314f8ed673a7b6d25c00ca48 (diff)
downloadexternal_llvm-970755e5197afb42a76a24a74cd6dc17721daf50.zip
external_llvm-970755e5197afb42a76a24a74cd6dc17721daf50.tar.gz
external_llvm-970755e5197afb42a76a24a74cd6dc17721daf50.tar.bz2
This patch is to fix radar://8426430. It is about llvm support of __builtin_debugtrap()
which is supposed to consistently raise SIGTRAP across all systems. In contrast, __builtin_trap() behave differently on different systems. e.g. it raises SIGTRAP on ARM, and SIGILL on X86. The purpose of __builtin_debugtrap() is to consistently provide "trap" functionality, in the mean time preserve the compatibility with on gcc on __builtin_trap(). The X86 backend is already able to handle debugtrap(). This patch is to: 1) make front-end recognize "__builtin_debugtrap()" (emboddied in the one-line change to Clang). 2) In DAG legalization phase, by default, "debugtrap" will be replaced with "trap", which make the __builtin_debugtrap() "available" to all existing ports without the hassle of changing their code. 3) If trap-function is specified (via -trap-func=xyz to llc), both __builtin_debugtrap() and __builtin_trap() will be expanded into the function call of the specified trap function. This behavior may need change in the future. The provided testing-case is to make sure 2) and 3) are working for ARM port, and we already have a testing case for x86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166300 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/trap.ll')
-rw-r--r--test/CodeGen/ARM/trap.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/trap.ll b/test/CodeGen/ARM/trap.ll
index 38842a9..21865f8 100644
--- a/test/CodeGen/ARM/trap.ll
+++ b/test/CodeGen/ARM/trap.ll
@@ -14,4 +14,16 @@ entry:
unreachable
}
+define void @t2() nounwind {
+entry:
+; INSTR: t2:
+; INSTR: trap
+
+; FUNC: t2:
+; FUNC: bl __trap
+ call void @llvm.debugtrap()
+ unreachable
+}
+
declare void @llvm.trap() nounwind
+declare void @llvm.debugtrap() nounwind