[PPCMIPeephole] Fix splat elimination
authorTim Shen <timshen91@gmail.com>
Wed, 12 Oct 2016 00:48:25 +0000 (00:48 +0000)
committerTim Shen <timshen91@gmail.com>
Wed, 12 Oct 2016 00:48:25 +0000 (00:48 +0000)
commit4ff62b187e7429521bd6a052bd8c68694177a051
tree53a8648cfeb7c82eee64f82e166108565087299a
parente04aebe904aea62e8079db4ac7f38585188ec47c
[PPCMIPeephole] Fix splat elimination

Summary:
In PPCMIPeephole, when we see two splat instructions, we can't simply do the following transformation:
  B = Splat A
  C = Splat B
=>
  C = Splat A
because B may still be used between these two instructions. Instead, we should make the second Splat a PPC::COPY and let later passes decide whether to remove it or not:
  B = Splat A
  C = Splat B
=>
  B = Splat A
  C = COPY B

Fixes PR30663.

Reviewers: echristo, iteratee, kbarton, nemanjai

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 283961
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
llvm/test/CodeGen/PowerPC/pr30663.ll [new file with mode: 0644]