[PATCH] D30670: [Outliner] Add tail call support

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 16:18:46 PST 2017


paquette created this revision.
Herald added subscribers: mehdi_amini, aemerson.

**Major changes:**
This commit adds tail-call support to the outliner. This works by making terminators/returns legal to outline if they are either already tail-calls, or they're the last instruction in a function. By doing this, we get two major benefits:

1. Exposure of new outlining candidates. There could be a repeated substring that was previously too short to outline which is sometimes adjacent to a return. The added return instruction could make it beneficial to outline.

2. Saved instructions. On x86-64, if we can tail call a candidate, we simply outline the terminator/return along with the candidate, saving us a return in tail-called cases. On other targets, this is more significant. For example, if we outline a candidate as a tail-call on ARM64, we can avoid saving/restoring the link register at the call-site, saving two instructions per outlined call.

**Minor changes:**

- Changes to machine-outliner.ll test to ensure that it won't break if the order of outlined functions changes
- Expanded on the comments on the outlining hooks in TargetInstrInfo.h


https://reviews.llvm.org/D30670

Files:
  include/llvm/Target/TargetInstrInfo.h
  lib/CodeGen/MachineOutliner.cpp
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrInfo.h
  test/CodeGen/X86/machine-outliner.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30670.90760.patch
Type: text/x-patch
Size: 19612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170307/945a335c/attachment.bin>


More information about the llvm-commits mailing list