From: Kewen Lin Date: Tue, 26 Oct 2021 02:05:02 +0000 (-0500) Subject: vect: Don't update inits for simd_lane_access DRs [PR102789] X-Git-Tag: releases/gcc-11.3.0~674 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cb3b868f702e63e53ee1880c6b8a61676144395;p=thirdparty%2Fgcc.git vect: Don't update inits for simd_lane_access DRs [PR102789] As PR102789 shows, when vectorizer does some peelings for alignment in prologues, function vect_update_inits_of_drs would update the inits of some drs. But as the failed case, we shouldn't update the dr for simd_lane_access, it has the fixed-length storage mainly for the main loop, the update can make the access out of bound and access the unexpected element. gcc/ChangeLog: PR tree-optimization/102789 * tree-vect-loop-manip.c (vect_update_inits_of_drs): Do not update inits of simd_lane_access. (cherry picked from commit f3dbd3f36d55178d0a9e4431043cbc950524969a) --- diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 012f48bd4870..d57108be5787 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -1822,7 +1822,8 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters, FOR_EACH_VEC_ELT (datarefs, i, dr) { dr_vec_info *dr_info = loop_vinfo->lookup_dr (dr); - if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt)) + if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt) + && !STMT_VINFO_SIMD_LANE_ACCESS_P (dr_info->stmt)) vect_update_init_of_dr (dr_info, niters, code); } }