This is an archive of the discontinued LLVM Phabricator instance.

[Power9] Disable removing extra swaps on P9 since it should not be needed.
ClosedPublic

Authored by stefanp on Jun 26 2017, 8:56 AM.

Details

Summary

On power 8 we sometimes insert swaps to deal with the difference between Little Endian and Big Endian. The swap removal pass is supposed to clean up these swaps. On power 9 we don't need this pass since we do not need to insert the swaps in the first place.

Diff Detail

Repository
rL LLVM

Event Timeline

stefanp created this revision.Jun 26 2017, 8:56 AM
nemanjai accepted this revision.Jun 29 2017, 12:35 AM

LGTM.

lib/Target/PowerPC/PPCTargetMachine.cpp
369 ↗(On Diff #103964)

Please add a comment such as

// Power ISA 3.0 has load/store instructions that preserve
// element order so swaps aren't introduced. The pass to remove
// them is thereby not necessary.
This revision is now accepted and ready to land.Jun 29 2017, 12:35 AM
inouehrs added inline comments.Jun 29 2017, 6:38 AM
lib/Target/PowerPC/PPCTargetMachine.cpp
371 ↗(On Diff #103964)

I feel it is better to use Subtarget.needsSwapsForVSXMemOps() to make the meaning of the check clearer.

nemanjai added inline comments.Jun 29 2017, 6:58 AM
lib/Target/PowerPC/PPCTargetMachine.cpp
371 ↗(On Diff #103964)

This is actually a really good point. I forgot that we added that function. Please use that instead.

jtony added inline comments.Jun 29 2017, 9:47 AM
lib/Target/PowerPC/PPCTargetMachine.cpp
371 ↗(On Diff #103964)

I agree with Hiroshi, this is a good way to increase code readability.

stefanp updated this revision to Diff 104861.Jun 30 2017, 7:44 AM

Sorry... We can't do what I wanted to do in the first place because I don't have access to the PPCSubtarget object in the PPCTargetMachine code.
I've moved the guard into the PPCVSXSwapRemoval code.

echristo accepted this revision.Jun 30 2017, 12:53 PM

This is how you should do it. Though I'm not sure it isn't just better to check for "processor >= power9", but *shrug* for now.

I've also marked getSubtargetImpl() as delete so you won't be tempted again. :)

This revision was automatically updated to reflect the committed changes.