[PATCH] D15271: Split functions to create shrink wrapping opportunities

Thomas Jablin via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 6 16:47:22 PST 2015


tjablin created this revision.
tjablin added reviewers: hfinkel, kbarton.
tjablin added a subscriber: llvm-commits.
Herald added a subscriber: aemerson.

Shrink wrapping functions can improve performance for functions
when the stack is unused. However, all functions where value
live-ranges contain function calls are ineligible for shrink
wrapping. Why?

1. To avoid saving and restoring values across call-sites, LLVM
allocates values with live-ranges that cross call sites to
callee-saved registers

2. If callee-saved registers are used, they must be
saved (usually in the function prolog)

3. ShrinkWrapping scans from the beginning of the function prolog
to the first use of the stack. If a callee-saved register is
saved to the stack in the function prolog, ShrinkWrapping will
give up early.

To increase the applicability of ShrinkWrapping, this pass
identifies instances where a live-range straddling a call-site
prevents ShrinkWrapping, and splits the original function into a
stackless ShrinkWrappable stub that potentially makes a tail call
to the remainder of the function.

This transformation harms debuggability and consequently is not
suitable for lower -O levels.

http://reviews.llvm.org/D15271

Files:
  lib/Target/PowerPC/CMakeLists.txt
  lib/Target/PowerPC/PPC.h
  lib/Target/PowerPC/PPCEnableShrinkWrap.cpp
  lib/Target/PowerPC/PPCTargetMachine.cpp
  test/CodeGen/PowerPC/EnableShrinkWrapTest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15271.42022.patch
Type: text/x-patch
Size: 19696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151207/25727d47/attachment.bin>


More information about the llvm-commits mailing list