[GlobalISel] Defer setting HasCalls on MachineFrameInfo to selection time.
authorAmara Emerson <aemerson@apple.com>
Fri, 20 Sep 2019 23:52:07 +0000 (23:52 +0000)
committerAmara Emerson <aemerson@apple.com>
Fri, 20 Sep 2019 23:52:07 +0000 (23:52 +0000)
commit7ac1039957f9aebcdf3ccf36cdd11067eb42b832
tree705c58a774d6a4d1c66e7d478b97263ea505ffe6
parent7d6a95cf83fcca92e64302194995601474bc161a
[GlobalISel] Defer setting HasCalls on MachineFrameInfo to selection time.

We currently always set the HasCalls on MFI during translation and legalization if
we're handling a call or legalizing to a libcall. However, if that call is later
optimized to a tail call then we don't need the flag. The flag being set to true
causes frame lowering to always save and restore FP/LR, which adds unnecessary code.

This change does the same thing as SelectionDAG and ports over some code that scans
instructions after selection, using TargetInstrInfo to determine if target opcodes
are known calls.

Code size geomean improvements on CTMark:
 -O0 : 0.1%
 -Os : 0.3%

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

llvm-svn: 372443
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/call-translator.ll
llvm/test/CodeGen/AArch64/GlobalISel/tail-call-no-save-fp-lr.ll [new file with mode: 0644]