This is an archive of the discontinued LLVM Phabricator instance.

[x86] enhance mayFoldLoad to check alignment
ClosedPublic

Authored by spatel on Oct 26 2021, 8:08 AM.

Details

Summary

As noted in D112464, a pre-AVX target can't fold an under-aligned vector load into another op, so we shouldn't report that as a load folding candidate. I only found one caller where this would make a difference -- combineCommutableSHUFP() -- so that's where I added a test to show the (minor) regression.

Diff Detail

Event Timeline

spatel created this revision.Oct 26 2021, 8:08 AM
spatel requested review of this revision.Oct 26 2021, 8:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2021, 8:08 AM
craig.topper added inline comments.Oct 26 2021, 8:19 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
5050

What about Subtarget->hasSSEUnalignedMem()?

spatel marked an inline comment as done.Oct 26 2021, 8:47 AM
spatel added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
5050

Ah, forgot about that possibility. I'll add the clause along with another RUN line to test it.

spatel updated this revision to Diff 382351.Oct 26 2021, 8:51 AM
spatel marked an inline comment as done.

Patch updated:
Added clause for hasSSEUnalignedMem() and adjusted test file with extra RUN line for that.

This revision is now accepted and ready to land.Oct 26 2021, 2:22 PM
This revision was landed with ongoing or failed builds.Oct 27 2021, 4:54 AM
This revision was automatically updated to reflect the committed changes.