I think the spotted correctness issues wrt alignment/aliasing should be addressed up-front. In the end the gather/stride-load is probably an UNSPEC, so there's no MEM RTX with wrong info? How would we query the target on whether it can handle the alignment here? Usually we go through vect_supportable_dr_alignment which asks targetm.vectorize.support_vector_misalignment which in turn gets packed_p as true in case the scalar load involved isn't aligned according to its size. But I'm not sure we'll end up there for gather/scatter or strided loads.
Irrespective of the gather/strided approach and the missing checks there - In the patch I used vect_supportable_dr_alignment for the data ref and the new vtype. Is that check insufficient or would that be OK for just this path? -- Regards Robin