[PATCH] D17948: Use CXX_FAST_TLS to enable shrink wrapping on PPC

Thomas Jablin via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 16:46:31 PST 2016


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

This patch depends on both D17533 and D16984.

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. The pass switches the calling convention to CXX_FAST_TLS, that saves callee registers to virtual registers. This allows the backend to make better choices about where to save registers and in many cases avoids saving registers to the stack. The exit block is privatized for the fast and slow exit paths to allow each to be specialized independently.

http://reviews.llvm.org/D17948

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: D17948.50009.patch
Type: text/x-patch
Size: 14320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160308/c1d356a4/attachment.bin>


More information about the llvm-commits mailing list