[ARM CodeGen] @llvm.debugtrap call may be removed when restoring callee saved registers
authorOleg Ranevskyy <oranevskyy@accesssoftek.com>
Fri, 23 Oct 2015 17:17:59 +0000 (17:17 +0000)
committerOleg Ranevskyy <oranevskyy@accesssoftek.com>
Fri, 23 Oct 2015 17:17:59 +0000 (17:17 +0000)
commitf1c16763a7b32c3187c7d8fd03c4eb501586924c
tree6c86cd6a1d82b0586418fbc7298eed5b79b8a5d6
parentcd69ab5ddf920a8740ffcb279206ad183b2582b1
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251123 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMFrameLowering.cpp
test/CodeGen/ARM/debugtrap.ll [new file with mode: 0644]