This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo.
ClosedPublic

Authored by gberry on Aug 10 2016, 1:01 PM.

Details

Summary

This re-factoring could cause the following slight changes in generated

code, though none were observed during testing:

- MachineScheduler could decide not to cluster some loads/stores if
  there are other load/stores with non-pairable opcodes that have the
  same base register and offset as a pairable set of load/stores.  One
  case of different MachineScheduler pairing did show up in my testing,
  but it wasn't due to this issue, but due
  BaseMemOpClusterMutation::clusterNeighboringMemOps() being unstable
  w.r.t. the order it considers memory operations.  See PR28942.

- The ImplicitNullChecks optimization could be done for more load/store
  opcodes.  This optimization isn't done for C/C++ code, so it didn't
  show up in my testing.

Diff Detail

Repository
rL LLVM

Event Timeline

gberry updated this revision to Diff 67580.Aug 10 2016, 1:01 PM
gberry retitled this revision from to [AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo. NFCI..
gberry updated this object.
gberry added reviewers: mcrosier, t.p.northover.
gberry added a subscriber: llvm-commits.
rovka accepted this revision.Aug 11 2016, 3:22 AM
rovka added a reviewer: rovka.
rovka added a subscriber: rovka.

LGTM

This revision is now accepted and ready to land.Aug 11 2016, 3:22 AM
mcrosier added inline comments.Aug 11 2016, 6:36 AM
lib/Target/AArch64/AArch64InstrInfo.cpp
1606 ↗(On Diff #67580)

The getMemOpBaseRegImmOfs() function is used to control lots of moving parts such as the clustering of loads and stores in the MI scheduler, scheduling in the swing modulo scheduler, and implicit null checks in machine sink, for example. Removing this switch and unconditionally calling getMemOpBaseRegImmOfsWidth will return true for many more opcodes (e.g., paired instructions, paired instructions with non-temporal hints, byte and halfword loads/stores).

I just wanted to point this out and confirm that you've done a fair amount of due diligence to make sure this really is a NFC.

gberry retitled this revision from [AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo. NFCI. to [AArch64] Re-factor code shared by AArch64LoadStoreOpt and AArch64InstrInfo..Aug 11 2016, 12:38 PM
gberry updated this object.
gberry edited edge metadata.
gberry added inline comments.
lib/Target/AArch64/AArch64InstrInfo.cpp
1606 ↗(On Diff #67580)

Yes, you are right, this change isn't quite NFC. I've updated the description to reflect this.

mcrosier edited edge metadata.Aug 11 2016, 1:59 PM

Okay, thanks for updating the description and filing the PR. LGTM as well.

This revision was automatically updated to reflect the committed changes.