[PATCH] D36721: [MachineOutliner] AArch64: Avoid saving + restoring LR if possible

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 16:43:02 PDT 2017


paquette created this revision.
Herald added subscribers: kristof.beyls, javed.absar, rengolin, aemerson.

This commit allows the outliner to avoid saving + restoring the link register on AArch64 when it is dead within an entire class of candidates. It also changes the interface for the outliner slightly to facilitate this.

By doing this, it's possible to find more outlining candidates in AArch64-- in the case that a candidate doesn't require a save/restore, that candidate can be far shorter. This allows us to find length 2 and 3 candidates and outline them.

This is still conservative. For example, if a length-3 candidate appears 20 times, and one of those times requires a save + restore, the outliner will assume all of them require a save + restore. Thus, none will be outlined. This will be fixed in later patches; the purpose of this is just to get the main idea going.

This, on average, improves the code size of the --benchmarking only SingleSource and MultiSource tests by about 2.94% in comparison to the current outliner. Several tests have no improvements; this is likely due to the conservative nature of the current technique.  36 of the tests improve by more than 10%. 4 tests regress, likely due to competing with linker deduping. This can likely be fixed by disallowing outlining from linkonceodr functions.

These were compiled with LNT using -Oz -mno-red-zone -mllvm -enable-machine-outliner and --benchmarking-only.

Full code size results: https://hastebin.com/raw/soloropiwo


https://reviews.llvm.org/D36721

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36721.111095.patch
Type: text/x-patch
Size: 20330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170814/50ddaed3/attachment.bin>


More information about the llvm-commits mailing list