[PATCH] D77788: [PowerPC][Future] Enable Tail Calls for PC Relative Code

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 03:46:00 PDT 2020


stefanp created this revision.
stefanp added reviewers: nemanjai, lei, hfinkel, PowerPC.
Herald added subscribers: shchenz, kbarton, hiraditya.

Tail Calls were initially disabled for PC Relative code because it was not safe to make certain assumptions about the tail calls (namely that all compiled functions no longer used the TOC pointer in R2 <https://reviews.llvm.org/source/clang-tools-extra/>). However, once all of the TOC pointer references have been removed it is safe to tail call everything that was tail called prior to the PC relative additions as well as a number of new cases.
For example, it is now possible to tail call indirect functions as there is no need to save and restore the TOC pointer for indirect functions if the caller is marked as may clobber R2 <https://reviews.llvm.org/source/clang-tools-extra/> (st_other=1). For the same reason it is now also possible to tail call functions that are external.


https://reviews.llvm.org/D77788

Files:
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
  llvm/test/CodeGen/PowerPC/pcrel-got-indirect.ll
  llvm/test/CodeGen/PowerPC/pcrel-tail-calls.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77788.256232.patch
Type: text/x-patch
Size: 18624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/598d942f/attachment-0001.bin>


More information about the llvm-commits mailing list