1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 14:33:02 +02:00
llvm-mirror/test/CodeGen/ARM/debugtrap.ll
Oleg Ranevskyy 6301d40eec [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
2015-10-23 17:17:59 +00:00

18 lines
461 B
LLVM

; 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
}