https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111970
--- Comment #11 from JuzheZhong <juzhe.zhong at rivai dot ai> --- Hi, Richard. I come back to revisit this bug. I found if I do this: diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 4a09b3c2aca..2fd128672b9 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -1434,7 +1434,6 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap, && rhs_code != CFN_GATHER_LOAD && rhs_code != CFN_MASK_GATHER_LOAD && rhs_code != CFN_MASK_LEN_GATHER_LOAD - && !STMT_VINFO_GATHER_SCATTER_P (stmt_info) /* Not grouped loads are handled as externals for BB vectorization. For loop vectorization we can handle splats the same we handle single element interleaving. */ The bug is fixed. But I am not sure whether it is the correct fix. Reproduce bug compile option on RISC-V: -O3 --param=riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math