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.
op = op1;
}
emit_vlmax_gather_insn (target, op, sel);
+ return;
}
/* Note: vec_perm indices are supposed to wrap when they go beyond the