[all-commits] [llvm/llvm-project] a60251: [PowerPC] Add linker opt for PC Relative GOT indir...

stefanp-ibm via All-commits all-commits at lists.llvm.org
Wed Jul 22 07:14:36 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a60251d739b97d506bbb9ea71d5f8ac9a3c155ce
      https://github.com/llvm/llvm-project/commit/a60251d739b97d506bbb9ea71d5f8ac9a3c155ce
  Author: Stefan Pintilie <stefanp at ca.ibm.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M llvm/include/llvm/MC/MCExpr.h
    M llvm/lib/MC/MCExpr.cpp
    M llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
    M llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.h
    M llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
    M llvm/lib/Target/PowerPC/PPC.h
    M llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
    M llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
    M llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
    M llvm/test/CodeGen/PowerPC/pcrel-call-linkage-with-calls.ll
    M llvm/test/CodeGen/PowerPC/pcrel-got-indirect.ll
    A llvm/test/CodeGen/PowerPC/pcrel-linkeropt.ll
    M llvm/test/CodeGen/PowerPC/pcrel-relocation-plus-offset.ll
    M llvm/test/CodeGen/PowerPC/pcrel-tail-calls.ll
    M llvm/test/CodeGen/PowerPC/pcrel.ll

  Log Message:
  -----------
  [PowerPC] Add linker opt for PC Relative GOT indirect accesses

A linker optimization is available on PowerPC for GOT indirect PCRelative loads.

The idea is that we can mark a usual GOT indirect load:

pld 3, vec at got@pcrel(0), 1
lwa 3, 4(3)

With a relocation to say that if we don't need to go through the GOT we can let
the linker further optimize this and replace a load with a nop.

  pld 3, vec at got@pcrel(0), 1
.Lpcrel1:
.reloc .Lpcrel1-8,R_PPC64_PCREL_OPT,.-(.Lpcrel1-8)
  lwa 3, 4(3)

This patch adds the logic that allows the compiler to add the R_PPC64_PCREL_OPT.

Reviewers: nemanjai, lei, hfinkel, sfertile, efriedma, tstellar, grosbach

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D79864




More information about the All-commits mailing list