[PATCH] D91983: [PowerPC] Fix missing nop after call to weak callee.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 10:54:07 PST 2020


stefanp created this revision.
stefanp added reviewers: nemanjai, NeHuang, lei.
Herald added subscribers: shchenz, kbarton, hiraditya.
Herald added a project: LLVM.
stefanp requested review of this revision.

Weak functions can be replaced by other functions at link time. Previously it
was assumed that no matter what the weak callee function was replaced with it
would still share the same TOC as the caller. This is no longer true as a weak
callee with a TOC setup can be replaced by another function that was compiled
with PC Relative and does not have a TOC at all.

This patch makes sure that all calls to functions defined as weak from a caller
that has a valid TOC have a nop after the call to allow a place for the linker
to restore the TOC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91983

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/test/CodeGen/PowerPC/ppc64-blnop.ll
  llvm/test/CodeGen/PowerPC/ppc64-calls.ll
  llvm/test/CodeGen/PowerPC/ppc64-sibcall.ll
  llvm/test/CodeGen/PowerPC/pr41088.ll
  llvm/test/CodeGen/PowerPC/preemption.ll
  llvm/test/CodeGen/PowerPC/xray-tail-call-hidden.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91983.307122.patch
Type: text/x-patch
Size: 7067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201123/3a358aaa/attachment.bin>


More information about the llvm-commits mailing list