This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add frame index alignment check if the the addressing mode is DS/DQ-Form, and fall back to X-Form if necessary.
ClosedPublic

Authored by amyk on Jul 8 2021, 2:30 PM.

Details

Summary

This patch adds a function that checks whether or not the frame index
is aligned when the computed addressing mode is an aligned D-Form (DS, or DQ-Form).
If the frame index appears to be unaligned, within these two modes, reset
the mode to X-Form in order to fall back to selection X-Form loads.

A test case is added to ensure that the test emits X-Form loads and not DQ-Form
loads since the frame index is not aligned within the test case.

For this patch, lxvx is produced since it's pattern utilizes ForceXForm, but this is
to ensure that the follow up patch, D95115, will continue to produce lxvx when the instruction is
updated to no longer use ForceXForm (and instead just use XForm).

Diff Detail

Event Timeline

amyk created this revision.Jul 8 2021, 2:30 PM
nemanjai accepted this revision.Jul 10 2021, 9:04 AM

My comments are stylistic so I don't have a problem with you addressing it on the commit without another review. LGTM.

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
17338

This is kind of minor, but when the whole function is inside a conditional block, it should probably just be an early return. You also don't really need a dyn_cast there - as far as I can tell you don't use FI. Probably a simple

if (!isa<FrameIndexSDNode>(N))
  return;

should suffice.

17339–17341

This can just be an or of the two conditions.

This revision is now accepted and ready to land.Jul 10 2021, 9:04 AM
amyk updated this revision to Diff 358317.Jul 13 2021, 9:56 AM
amyk marked 2 inline comments as done.
amyk removed a subscriber: post.kadirselcuk.

Update revision to reflect the suggestions made by Nemanja.

This revision was landed with ongoing or failed builds.Jul 13 2021, 10:32 AM
This revision was automatically updated to reflect the committed changes.