This backport contains 1 patch from gcc main stream tree. The commit id of these patchs list as following in the order of time. 0001-vect-ICE-in-vectorizable_load-at-tree-vect-stmts.c-9.patch: f14b41d27124601284347a10d496362c8b4b8e1c diff -Nurp a/gcc/testsuite/gcc.target/aarch64/pr94398.c b/gcc/testsuite/gcc.target/aarch64/pr94398.c --- a/gcc/testsuite/gcc.target/aarch64/pr94398.c 1970-01-01 08:00:00.000000000 +0800 +++ b/gcc/testsuite/gcc.target/aarch64/pr94398.c 2020-04-17 17:15:58.176000000 +0800 @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-vectorize -funsafe-math-optimizations -march=armv8.2-a+sve -mstrict-align" } */ + +float +foo(long n, float *x, int inc_x, + float *y, int inc_y) +{ + float dot = 0.0; + int ix = 0, iy = 0; + + if (n < 0) { + return dot; + } + + int i = 0; + while (i < n) { + dot += y[iy] * x[ix]; + ix += inc_x; + iy += inc_y; + i++; + } + + return dot; +} diff -Nurp a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c --- a/gcc/tree-vect-stmts.c 2020-04-17 17:10:14.796000000 +0800 +++ b/gcc/tree-vect-stmts.c 2020-04-17 17:15:08.611850850 +0800 @@ -7025,8 +7025,14 @@ vectorizable_store (stmt_vec_info stmt_i auto_vec dr_chain (group_size); oprnds.create (group_size); - alignment_support_scheme - = vect_supportable_dr_alignment (first_dr_info, false); + /* Gather-scatter accesses perform only component accesses, alignment + is irrelevant for them. */ + if (memory_access_type == VMAT_GATHER_SCATTER) + alignment_support_scheme = dr_unaligned_supported; + else + alignment_support_scheme + = vect_supportable_dr_alignment (first_dr_info, false); + gcc_assert (alignment_support_scheme); vec_loop_masks *loop_masks = (loop_vinfo && LOOP_VINFO_FULLY_MASKED_P (loop_vinfo) @@ -8162,8 +8168,14 @@ vectorizable_load (stmt_vec_info stmt_in ref_type = reference_alias_ptr_type (DR_REF (first_dr_info->dr)); } - alignment_support_scheme - = vect_supportable_dr_alignment (first_dr_info, false); + /* Gather-scatter accesses perform only component accesses, alignment + is irrelevant for them. */ + if (memory_access_type == VMAT_GATHER_SCATTER) + alignment_support_scheme = dr_unaligned_supported; + else + alignment_support_scheme + = vect_supportable_dr_alignment (first_dr_info, false); + gcc_assert (alignment_support_scheme); vec_loop_masks *loop_masks = (loop_vinfo && LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)