This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] ease alignment restriction for converting masked load to normal load
ClosedPublic

Authored by spatel on Sep 29 2020, 10:53 AM.

Details

Summary

I think we made this fold conservative to be safer, but we do not need the alignment attribute/metadata limitation because the masked load intrinsic itself specifies the alignment. A normal vector load is better for IR transforms and should be no worse in codegen than the masked alternative. If it is worse for some target, the backend can reverse this transform.

Diff Detail

Event Timeline

spatel created this revision.Sep 29 2020, 10:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2020, 10:53 AM
spatel requested review of this revision.Sep 29 2020, 10:53 AM

This seems obviously correct (C) to me, but i'm not very familiar with masked intrinsics semantics in LLVM, so i'll leave it for other reviewers.

efriedma accepted this revision.Sep 29 2020, 11:17 AM

LGTM

(I doubt this will come up often; most sources of "dereferenceable" also provide alignment. But it makes sense in any case.)

This revision is now accepted and ready to land.Sep 29 2020, 11:17 AM

LGTM

(I doubt this will come up often; most sources of "dereferenceable" also provide alignment. But it makes sense in any case.)

I missed posting this comment before commit:
The motivation comes from increased use of masked loads that would be produced by SLP with the current proposal in D57059. I suspect SLP could/should do a better job of producing canonical code, but it's a mess and relies on instcombine for cleanup.