This is an archive of the discontinued LLVM Phabricator instance.

[PPCMIPeephole] Fix splat elimination
ClosedPublic

Authored by timshen on Oct 11 2016, 5:26 PM.

Details

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

Diff Detail

Repository
rL LLVM

Event Timeline

timshen updated this revision to Diff 74312.Oct 11 2016, 5:26 PM
timshen retitled this revision from to [PPCMIPeephole] Fix splat elimination.
timshen updated this object.
timshen added a subscriber: llvm-commits.
echristo accepted this revision.Oct 11 2016, 5:40 PM
echristo edited edge metadata.
echristo added inline comments.
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
207 ↗(On Diff #74312)

Should probably build rather than change in-place?

This revision is now accepted and ready to land.Oct 11 2016, 5:40 PM
echristo requested changes to this revision.Oct 11 2016, 5:40 PM
echristo edited edge metadata.
This revision now requires changes to proceed.Oct 11 2016, 5:40 PM
timshen updated this revision to Diff 74313.Oct 11 2016, 5:47 PM
timshen edited edge metadata.

Updated to build a new instruction instead of mutating the original one.

timshen marked an inline comment as done.Oct 11 2016, 5:47 PM
echristo accepted this revision.Oct 11 2016, 5:49 PM
echristo edited edge metadata.

LGTM.

Thanks!

-eric

This revision is now accepted and ready to land.Oct 11 2016, 5:49 PM
This revision was automatically updated to reflect the committed changes.