masked_load and masked_store instructions require the alignment to be specified and a power of two. It seems to me that this requirement applies to masked_gather and masked_scatter as well.
CreateAlignedLoad allows align 0, as far as I see in the code.
We just assume that masked.gather is created from scalar load by vectorizer. Vectorizer just copies alignment from scalar load to masked load/gather and the requirement to alignment should match load alignment.
I see, then you're write that 0 should be allowed.
I'm trying to tighten the alignment type throughout LLVM so I always try to have the most restrictive type.
I'll change the Patch accordingly.