From: Jin Ma Date: Tue, 2 Jun 2026 13:07:00 +0000 (-0600) Subject: [PATCH] RISC-V: Fix missing return in expand_vec_perm X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=fe33ae48bf00ccb492bd65980899ca2bc421dabc;p=thirdparty%2Fgcc.git [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 --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index b7dd1c8279a..2f1d1be50d6 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