https://gcc.gnu.org/g:fe33ae48bf00ccb492bd65980899ca2bc421dabc
commit r17-1223-gfe33ae48bf00ccb492bd65980899ca2bc421dabc Author: Jin Ma <[email protected]> Date: Tue Jun 2 07:07:00 2026 -0600 [PATCH] RISC-V: Fix missing return in expand_vec_perm 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. Diff: --- 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 b7dd1c8279ad..2f1d1be50d69 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -3320,6 +3320,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
