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.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
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.
Comment Actions
LGTM
(I doubt this will come up often; most sources of "dereferenceable" also provide alignment. But it makes sense in any case.)
Comment Actions
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.