[PATCH] D81126: [PowerPC] Fix for PC Relative call protocol

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 18:13:01 PDT 2020


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

The situation where the caller uses a TOC and the callee does not but is marked as clobbers the TOC (st_other=1) was not being compiled correctly if both functions where in the same object file.
The call site where we had `callee` was missing a nop after the call. This is because it was assumed that since the two functions where in the same DSO they would be sharing a TOC. This is not the case if the callee uses PC Relative because in that case it may clobber the TOC.
This patch makes sure that we add the cnop correctly so that the linker has a place to restore the TOC.


https://reviews.llvm.org/D81126

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/pcrel-local-caller-toc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81126.268339.patch
Type: text/x-patch
Size: 4817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200604/6805d02d/attachment.bin>


More information about the llvm-commits mailing list