summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/debugtrap.ll
diff options
context:
space:
mode:
authorOleg Ranevskyy <oranevskyy@accesssoftek.com>2015-10-23 17:17:59 +0000
committerOleg Ranevskyy <oranevskyy@accesssoftek.com>2015-10-23 17:17:59 +0000
commit6389dd9fa2ecffcc3178c4fa65169f44e0a3d694 (patch)
treec16103cf0cdfc558e290a8b8e8d0f049c5f57e6b /llvm/test/CodeGen/ARM/debugtrap.ll
parent5f78c5c293de2ef0f91bf519c3e4f6b0573d2536 (diff)
downloadbcm5719-llvm-6389dd9fa2ecffcc3178c4fa65169f44e0a3d694.tar.gz
bcm5719-llvm-6389dd9fa2ecffcc3178c4fa65169f44e0a3d694.zip
[ARM CodeGen] @llvm.debugtrap call may be removed when restoring callee saved registers
Summary: When ARMFrameLowering::emitPopInst generates a "pop" instruction to restore the callee saved registers, it checks if the LR register is among them. If so, the function may decide to remove the basic block's terminator and replace it with a "pop" to the PC register instead of LR. This leads to a problem when the block's terminator is preceded by a "llvm.debugtrap" call. The MI iterator points to the trap in such a case, which is also a terminator. If the function decides to restore LR to PC, it erroneously removes the trap. Reviewers: asl, rengolin Subscribers: aemerson, jfb, rengolin, dschuff, llvm-commits Differential Revision: http://reviews.llvm.org/D13672 llvm-svn: 251123
Diffstat (limited to 'llvm/test/CodeGen/ARM/debugtrap.ll')
-rw-r--r--llvm/test/CodeGen/ARM/debugtrap.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/debugtrap.ll b/llvm/test/CodeGen/ARM/debugtrap.ll
new file mode 100644
index 00000000000..9ce73939ce5
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/debugtrap.ll
@@ -0,0 +1,17 @@
+; This test ensures the @llvm.debugtrap() call is not removed when generating
+; the 'pop' instruction to restore the callee saved registers on ARM.
+
+; RUN: llc < %s -mtriple=armv7 -O0 -filetype=asm | FileCheck %s
+
+declare void @llvm.debugtrap() nounwind
+declare void @foo() nounwind
+
+define void @test() nounwind {
+entry:
+ ; CHECK: bl foo
+ ; CHECK-NEXT: pop
+ ; CHECK-NEXT: trap
+ call void @foo()
+ call void @llvm.debugtrap()
+ ret void
+}
OpenPOWER on IntegriCloud