[MachineOutliner] Drop candidates that require fixups if it's beneficial
authorJessica Paquette <jpaquette@apple.com>
Mon, 3 Dec 2018 19:11:27 +0000 (19:11 +0000)
committerJessica Paquette <jpaquette@apple.com>
Mon, 3 Dec 2018 19:11:27 +0000 (19:11 +0000)
commit2accb31690bcf8572ba926c5d847b1c457000917
tree612e4442f7ed326b64f784cbaf4642de16ff5d39
parent71a7f447f6531baadede4962e13c9e3d407478e3
[MachineOutliner] Drop candidates that require fixups if it's beneficial

If it's a bigger code size win to drop candidates that require stack fixups
than to demote every candidate to that variant, the outliner should do that.

This happens if the number of bytes taken by calls to functions that don't
require fixups, plus the number of bytes that'd be left is less than the
number of bytes that it'd take to emit a save + restore for all candidates.

Also add tests for each possible new behaviour.

- machine-outliner-compatible-candidates shows that when we have candidates
that don't use the stack, we can use the default call variant along with the
no save/regsave variant.

- machine-outliner-all-stack shows that when it's better to fix up the stack,
we still will demote all candidates to that case

- machine-outliner-drop-stack shows that we can discard candidates that
require stack fixups when it would be beneficial to do so.

llvm-svn: 348168
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/test/CodeGen/AArch64/machine-outliner-all-stack.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-compatible-candidates.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/machine-outliner-drop-stack.mir [new file with mode: 0644]