[ARM] Avoid spilling lr with Thumb1 tail calls.
authorEli Friedman <efriedma@codeaurora.org>
Wed, 8 Aug 2018 20:03:10 +0000 (20:03 +0000)
committerEli Friedman <efriedma@codeaurora.org>
Wed, 8 Aug 2018 20:03:10 +0000 (20:03 +0000)
commit5b45a390568c5245ab3b1df5be68536c785ee3ae
treeda23c168ba9e0a2a7b4fb8db2c652f086c2bbb1e
parent0a4f6be4434c9c5d03d9e7ed46ed21af1fdd6a1a
[ARM] Avoid spilling lr with Thumb1 tail calls.

Normally, if any registers are spilled, we prefer to spill lr on Thumb1
so we can fold the "bx lr" into the "pop".  However, if there are tail
calls involved, restoring lr is expensive, so skip the optimization in
that case.

The spill of r7 in the new test also isn't necessary, but that's
mostly orthogonal to this patch. (It's the same code in
ARMFrameLowering, but it's not related to tail calls.)

Differential Revision: https://reviews.llvm.org/D49459

llvm-svn: 339283
llvm/lib/Target/ARM/ARMFrameLowering.cpp
llvm/test/CodeGen/ARM/v8m-tail-call.ll