[ARM] Make sure to save/restore LR when we use tBfar.
authorEli Friedman <efriedma@quicinc.com>
Tue, 19 Mar 2019 21:48:08 +0000 (21:48 +0000)
committerEli Friedman <efriedma@quicinc.com>
Tue, 19 Mar 2019 21:48:08 +0000 (21:48 +0000)
commit2596e8b3e7ed59381405e39e7f73cf044928e0bb
tree8f539cfb9ee22973836b46996ac6a1585be715ec
parent761ca2e53b843cc40637c1d418d7b38e3cbee158
[ARM] Make sure to save/restore LR when we use tBfar.

This change does two things. One, it ensures compilation will abort
instead of miscompiling if ARMFrameLowering::determineCalleeSaves
chooses not to save LR in a case where it's necessary.  Two, it changes
the way we estimate the size of a function to be more conservative in
the presence of constant pool entries and jump tables.

EstimateFunctionSizeInBytes probably still isn't really conservative
enough, but I'm not sure how we can come up with a reliable estimate
before constant islands runs.

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

llvm-svn: 356527
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
llvm/lib/Target/ARM/ARMFrameLowering.cpp
llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
llvm/test/CodeGen/Thumb/large-fn-switch.ll [new file with mode: 0644]