[PATCH] D39536: [PowerPC] Eliminate redundant register copys after register allocation

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 01:48:19 PDT 2017


inouehrs created this revision.
Herald added a subscriber: mgorny.

This patch add a PPC-specific path after register allocation to eliminate redundancy related register copies among physical registers.

So far, we eliminate the following two types of redundant register copys.

1. intra-BB redundant register copy

  li Y, 0          li X, 0  (any instruction, not limited to li)
  mr X, Y    =>    (erase mr)
  ..               ..

2. inter-BB partially redundant register copy

            BB1--------                             BB1--------
            | ..      |                             | ..      |
            | mr Y, X |                             | (erase) |
            | ..      |                             | ..      |
    with    -----------                    with     -----------
    1 pred /     |                         1 pred  /     |
  BB--------     |      BB--------      BB---------      |      BB---------
  | ..     |     |      | ..     |  =>  | mr Y, X |      |      | ..      |
  | ..     |     |      | ..     |      | ..      |      |      | mr X, Y |
  ----------     |      ----------      -----------      |      -----------
                 |     /  with                           |     /  with
            BB2--------   1 succ                    BB2--------   1 succ
            | ..      |                             | ..      |
            | mr X, Y |                             | (erase) |
            | ..      |                             | ..      |
            -----------                             -----------


https://reviews.llvm.org/D39536

Files:
  lib/Target/PowerPC/CMakeLists.txt
  lib/Target/PowerPC/PPC.h
  lib/Target/PowerPC/PPCPostRAPeephole.cpp
  lib/Target/PowerPC/PPCTargetMachine.cpp
  test/CodeGen/PowerPC/aggressive-anti-dep-breaker-subreg.ll
  test/CodeGen/PowerPC/ppc64-byval-align.ll
  test/CodeGen/PowerPC/redundant_regcopy.ll
  test/CodeGen/PowerPC/redundant_regcopy_1.mir
  test/CodeGen/PowerPC/redundant_regcopy_2.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39536.121249.patch
Type: text/x-patch
Size: 23066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171102/f6d18d20/attachment.bin>


More information about the llvm-commits mailing list