[PATCH] D47173: [MachineOutliner] Add "thunk" outlining for AArch64.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 18:14:54 PDT 2018


efriedma created this revision.
efriedma added a reviewer: paquette.
Herald added a reviewer: javed.absar.
Herald added a subscriber: kristof.beyls.

When we're outlining a sequence that ends in a call, we can save up to three instructions in the outlined function by turning the call into a tail-call. I refer to this as thunk outlining because the resulting outlined function looks like a thunk; suggestions welcome for a better name.

In addition to making the outlined function shorter, thunk outlining allows outlining calls which would otherwise be illegal to outline: we don't need to save/restore LR, so we don't need to prove anything about the stack access patterns of the callee.

To make this work effectively, I also added MachineOutlinerInstrType::LegalTerminator to the generic MachineOutliner code.  This allows treating an arbitrary instruction as a terminator in the suffix tree.  (I also experimented with rejecting sequences from getOutlininingCandidateInfo, but it didn't work as well.)


Repository:
  rL LLVM

https://reviews.llvm.org/D47173

Files:
  include/llvm/CodeGen/TargetInstrInfo.h
  lib/CodeGen/MachineOutliner.cpp
  lib/Target/AArch64/AArch64InstrInfo.cpp
  test/CodeGen/AArch64/machine-outliner-thunk.ll
  test/CodeGen/AArch64/machine-outliner.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47173.147926.patch
Type: text/x-patch
Size: 13028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/847826b3/attachment.bin>


More information about the llvm-commits mailing list