[PATCH] D63803: [PowerPC] Move TOC save to prologue when profitable

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 19:42:16 PDT 2019


nemanjai created this revision.
nemanjai added reviewers: hfinkel, jsji, saghir, stefanp.
Herald added subscribers: kbarton, hiraditya.
Herald added a project: LLVM.

The indirect call sequence on PPC requires that the TOC base register be saved prior to the indirect call and restored after the call since the indirect call may branch to a global entry point in another DSO which will update the TOC base. Over the last couple of years, we have improved this to:

- be able to hoist TOC saves from loops (with changes to MachineLICM)
- avoid multiple saves when one dominates the other[s]

However, it is still possible to have multiple TOC saves dynamically in the execution path if there is no dominance relationship between them.

This patch moves the TOC save to the prologue when one of the TOC saves is in a block that post-dominates entry (i.e. it cannot be avoided) or if it is in a block that is hotter than entry.


Repository:
  rL LLVM

https://reviews.llvm.org/D63803

Files:
  llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
  llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
  llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h
  llvm/test/CodeGen/PowerPC/MCSE-caller-preserved-reg.ll
  llvm/test/CodeGen/PowerPC/tocSaveInPrologue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63803.206576.patch
Type: text/x-patch
Size: 12735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190626/007dc6a7/attachment.bin>


More information about the llvm-commits mailing list