This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Considering existing offset in the alignment when folding ADDIs into load/store.
ClosedPublic

Authored by craig.topper on Jul 1 2022, 10:32 AM.

Details

Summary

getPointerAlignment and ConstantPoolSDNode::getAlign only consider
the alignment of the object. If we already have a non-zero offset
into the offset that may have reduced the alignment.

Since the base pointer will become an LUI with the old offset, we
need to be sure the new offset fits in the alignment of the address
that will be used to create the LUI immediate.

I'm not sure it is possible to have a non-zero offset in the
GlobalAddressSDNode or ConstantPoolSDNode at this point today so this
may only be a theoretical bug.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 1 2022, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2022, 10:32 AM
craig.topper requested review of this revision.Jul 1 2022, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2022, 10:32 AM
reames accepted this revision.Jul 1 2022, 11:01 AM

LGTM

This revision is now accepted and ready to land.Jul 1 2022, 11:01 AM
This revision was landed with ongoing or failed builds.Jul 1 2022, 11:19 AM
This revision was automatically updated to reflect the committed changes.