[PowerPC] Remove self-copies in pre-emit peephole
commitedb9a19f3804cfe690c57b57d3b82d1487252aa2
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Tue, 9 Oct 2018 10:54:04 +0000 (9 10:54 +0000)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Tue, 9 Oct 2018 10:54:04 +0000 (9 10:54 +0000)
treee2cb23bf612e3d9bf80e0972d337536c0799a7ab
parent6027f5ef522a1f966d0a0bf083969e69daa2aabd
[PowerPC] Remove self-copies in pre-emit peephole

There are occasionally instances where AADB rewrites registers in such a way
that a reg-reg copy becomes a self-copy. Such an instruction is obviously
redundant and can be removed. This patch does precisely that.

Note that this will not remove various nop's that we insert (which are
themselves just self-copies). The reason those are left alone is that all of
them have their own opcodes (that just encode to a self-copy).

What prompted this patch is the fact that these self-copies sometimes end up
using registers that make the instruction a priority-setting nop, thereby
having a significant effect on performance.

Differential revision: https://reviews.llvm.org/D52432

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344036 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCInstrInfo.h
lib/Target/PowerPC/PPCPreEmitPeephole.cpp
test/CodeGen/PowerPC/remove-self-copies.mir [new file with mode: 0644]