> In expand_vec_perm, the branch handling a selector that is a constant > duplicate (all indices identical) emits a VLMAX vrgather and is then > meant to be done. The missing return let control fall through into the > generic modulo-index handling below, which recomputes and overwrites > the target with another gather sequence. > > Add the return so the duplicate path stops after the gather. > > No test case is added: without the return the first gather is a dead > store to the target that the generic path immediately overwrites, so it > is removed by later RTL dead-store elimination and the final assembly is > identical with and without the fix. No test can therefore observe the > change. > > gcc/ChangeLog: > > * config/riscv/riscv-v.cc (expand_vec_perm): Add missing return > after emit_vlmax_gather_insn. > --- > gcc/config/riscv/riscv-v.cc | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc > index c2b2e346d0a..9a0c747f8a0 100644 > --- a/gcc/config/riscv/riscv-v.cc > +++ b/gcc/config/riscv/riscv-v.cc > @@ -3321,6 +3321,7 @@ expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel) > op = op1; > } > emit_vlmax_gather_insn (target, op, sel); > + return; > } > > /* Note: vec_perm indices are supposed to wrap when they go beyond the
OK. -- Regards Robin
