[all-commits] [llvm/llvm-project] 02141a: [PowerPC][Future] Remove redundant r2 save and res...

Victor Huang via All-commits all-commits at lists.llvm.org
Wed Apr 22 10:07:26 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 02141a17aea0603b89baee14febea6a3b89474d1
      https://github.com/llvm/llvm-project/commit/02141a17aea0603b89baee14febea6a3b89474d1
  Author: Victor Huang <wei.huang at ibm.com>
  Date:   2020-04-22 (Wed, 22 Apr 2020)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCISelLowering.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-indirect-call.ll

  Log Message:
  -----------
  [PowerPC][Future] Remove redundant r2 save and restore for indirect call

Currently an indirect call produces the following sequence on PCRelative mode:

extern void function( );
extern void (*ptrfunc) ( );

void g() {
    ptrfunc=function;
}

void f() {
    (*ptrfunc) ( );
}

Producing

paddi 3, 0, .LC0 at PCREL, 1
ld 3, 0(3)
std 2, 24(1)
ld 12, 0(3)
mtctr 12
bctrl
ld 2, 24(1)

Though the caller does not use or preserve r2, it is still saved and restored
across a function call. This patch is added to remove these redundant save and
restores for indirect calls.

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




More information about the All-commits mailing list