[PowerPC] Remove redundant load immediate instructions
authorYi-Hong Lyu <Yi-Hong.Lyu@ibm.com>
Tue, 23 Jul 2019 19:11:07 +0000 (19:11 +0000)
committerYi-Hong Lyu <Yi-Hong.Lyu@ibm.com>
Tue, 23 Jul 2019 19:11:07 +0000 (19:11 +0000)
commit41a010a4ef16f5c67c45d759f5d664c24e8a7afe
tree6df2f3929a9afb7b5185b0a312e7e7591d3e65a6
parent62ac91f36909b8d8d964c0536075f73537f15f09
[PowerPC] Remove redundant load immediate instructions

Currently PowerPC backend emits code like this:

  r3 = li 0
  std r3, 264(r1)
  r3 = li 0
  std r3, 272(r1)

This patch fixes that and other cases where a register already contains a value that is loaded so we will get:

  r3 = li 0
  std r3, 264(r1)
  std r3, 272(r1)

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

llvm-svn: 366840
llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
llvm/test/CodeGen/PowerPC/remove-redundant-load-imm.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/remove-redundant-load-imm.mir [new file with mode: 0644]